equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Implementation for class encoding octet strings in ASN1 DER |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include <asn1enc.h> |
|
21 |
|
22 EXPORT_C CASN1EncOctetString* CASN1EncOctetString::NewLC(const TDesC8& aStr) |
|
23 { |
|
24 CASN1EncOctetString* self = new (ELeave) CASN1EncOctetString(); |
|
25 CleanupStack::PushL(self); |
|
26 self->ConstructL(aStr); |
|
27 return self; |
|
28 } |
|
29 |
|
30 EXPORT_C CASN1EncOctetString* CASN1EncOctetString::NewL(const TDesC8& aStr) |
|
31 { |
|
32 CASN1EncOctetString* self = NewLC(aStr); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 EXPORT_C CASN1EncOctetString::~CASN1EncOctetString() |
|
38 { |
|
39 delete iContents; |
|
40 } |
|
41 |
|
42 |
|
43 CASN1EncOctetString::CASN1EncOctetString() |
|
44 : CASN1EncPrimitive(EASN1OctetString) |
|
45 { |
|
46 } |
|
47 |
|
48 |
|
49 void CASN1EncOctetString::ConstructL(const TDesC8& aStr) |
|
50 { |
|
51 iContents = aStr.AllocL(); |
|
52 CASN1EncPrimitive::ConstructL(); |
|
53 } |
|
54 |
|
55 |
|
56 void CASN1EncOctetString::CalculateContentsLengthDER() |
|
57 { |
|
58 iContentsLengthDER = iContents->Length(); |
|
59 } |
|
60 |
|
61 |
|
62 void CASN1EncOctetString::WriteContentsDERL(TDes8& aBuf) const |
|
63 { |
|
64 aBuf.Copy(*iContents); |
|
65 } |