Update contrib.
2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
39 IMPORT_C explicit TASN1DecGeneric(const TDesC8& aSource);
40 IMPORT_C void InitL();
41 IMPORT_C TPtrC8 Encoding() const;
42 IMPORT_C TInt LengthDER() const;
43 IMPORT_C TPtrC8 GetContentDER(void) const;
44 IMPORT_C TInt LengthDERContent(void) const;
45 IMPORT_C TInt LengthDERHeader() const;
46 IMPORT_C TTagType Tag() const;
47 IMPORT_C TASN1Class Class() const;
50 TInt iStartOfContents;
52 TTagType iExplicitTag;
60 IMPORT_C TASN1DecString(const TTagType aTag);
61 virtual TInt CheckValid(const TDesC8& aSource)=0;
67 IMPORT_C TASN1DecBoolean();
68 IMPORT_C TBool DecodeDERL(const TDesC8& aSource,TInt& aPos);
69 IMPORT_C TBool DecodeDERL(const TASN1DecGeneric& Source);
76 IMPORT_C TASN1DecNull();
77 IMPORT_C void DecodeDERL(const TDesC8& aSource,TInt& aPos);
78 IMPORT_C void DecodeDERL(const TASN1DecGeneric& aSource);
81 class TASN1DecEnumerated
84 IMPORT_C TASN1DecEnumerated(void);
90 IMPORT_C TASN1DecInteger();
91 IMPORT_C TInt DecodeDERShortL(const TDesC8& aSource,TInt& aPos);
92 IMPORT_C TInt DecodeDERShortL(const TASN1DecGeneric& aSource);
93 IMPORT_C RInteger DecodeDERLongL(const TDesC8& aSource,TInt& aPos);
94 IMPORT_C RInteger DecodeDERLongL(const TASN1DecGeneric& aSource);
97 const TInt KNumberOfIDs=15;
99 class TASN1DecObjectIdentifier
102 IMPORT_C TASN1DecObjectIdentifier();
103 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
104 IMPORT_C HBufC* DecodeDERL(const TASN1DecGeneric& aSource);
106 TInt DecodeContentsL(TFixedArray<TInt, KNumberOfIDs>& aOID, const TDesC8& aSource);
112 IMPORT_C TASN1DecSet();
113 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* NewDERLC(const TDesC8& aSource);
114 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TDesC8& aSource,TInt& aPos);
115 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TASN1DecGeneric& aSource);
116 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TDesC8& aSource,TInt& aPos, TInt aMin, TInt aMax);
117 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TASN1DecGeneric& aSource, TInt aMin, TInt aMax);
119 /** @internalComponent */
120 void DecodeContentsL(const TDesC8& aSource, TInt& aPos, CArrayPtrFlat<TASN1DecGeneric>& aDest);
121 /** @internalComponent */
122 static void CleanupSet(TAny* aArray);
125 class TASN1DecGraphicString
128 IMPORT_C TASN1DecGraphicString();
129 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
131 IMPORT_C TInt CheckValid(const TDesC8& aSource);
133 HBufC* DecodeContentsL(const TDesC8& aSource);
136 class TASN1DecVisibleString
139 IMPORT_C TASN1DecVisibleString(void);
140 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
142 IMPORT_C TInt CheckValid(const TDesC8& aSource);
144 HBufC* DecodeContentsL(const TDesC8& aSource);
147 class TASN1DecGeneralizedTime
150 IMPORT_C TASN1DecGeneralizedTime();
151 IMPORT_C TTime DecodeDERL(const TDesC8& aSource, TInt& aPos);
152 IMPORT_C TTime DecodeDERL(const TASN1DecGeneric& aGen);
154 TTime GetTimeL(const TDesC8& aSource);
157 class TASN1DecUTCTime
160 IMPORT_C TASN1DecUTCTime();
161 IMPORT_C TTime DecodeDERL(const TASN1DecGeneric& aGen);
162 IMPORT_C TTime DecodeDERL(const TDesC8& aSource, TInt& aPos);
164 TTime GetTimeL(const TDesC8& aSource);
167 class TASN1DecBitString
170 IMPORT_C TASN1DecBitString();
171 IMPORT_C HBufC8* DecodeDERL(const TDesC8& aSource,TInt& aPos);
172 IMPORT_C HBufC8* DecodeDERL(const TASN1DecGeneric& aSource);
173 //we need the next 2 functions because many standards encode things as bit
175 IMPORT_C HBufC8* ExtractOctetStringL(const TDesC8& aSource,TInt& aPos);
176 IMPORT_C HBufC8* ExtractOctetStringL(const TASN1DecGeneric& aSource);
179 class TASN1DecIA5String
182 IMPORT_C TASN1DecIA5String();
183 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
184 IMPORT_C HBufC* DecodeDERL(const TASN1DecGeneric& aSource);
186 IMPORT_C TInt CheckValid(const TDesC8& aSource);
188 HBufC* DecodeContentsL(const TDesC8& aSource);
192 class TASN1DecUTF8String
195 IMPORT_C TASN1DecUTF8String();
196 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
197 IMPORT_C HBufC* DecodeDERL(const TASN1DecGeneric& aSource);
199 IMPORT_C TInt CheckValid(const TDesC8& aSource);
201 HBufC* DecodeContentsL(const TDesC8& aSource);
204 class TASN1DecGeneralString
207 IMPORT_C TASN1DecGeneralString();
208 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
210 IMPORT_C TInt CheckValid(const TDesC8& aSource);
212 HBufC* DecodeContentsL(const TDesC8& aSource);
215 class TASN1DecOctetString
218 IMPORT_C TASN1DecOctetString();
219 IMPORT_C HBufC8* DecodeDERL(const TDesC8& aSource,TInt& aPos);
220 IMPORT_C HBufC8* DecodeDERL(const TASN1DecGeneric& aSource);
222 IMPORT_C TInt CheckValid(const TDesC8& aSource);
225 class TASN1DecNumericString
228 IMPORT_C TASN1DecNumericString();
229 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
231 /** @internalComponent */
232 TInt CheckValid(const TDesC8& aSource);
234 HBufC* DecodeContentsL(const TDesC8& aSource);
237 class TASN1DecVideotexString
240 IMPORT_C TASN1DecVideotexString();
241 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
243 IMPORT_C TInt CheckValid(const TDesC8& aSource);
245 HBufC* DecodeContentsL(const TDesC8& aSource);
248 class TASN1DecPrintableString
251 IMPORT_C TASN1DecPrintableString();
252 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
253 IMPORT_C HBufC* DecodeDERL(const TASN1DecGeneric& aSource);
255 /** @internalComponent */
256 TInt CheckValid(const TDesC8& aSource);
258 HBufC* DecodeContentsL(const TDesC8& aSource);
262 * Class used for decoding Teletex strings.
263 * The TeletexString type is not fully supported by this library.
264 * Instead the decode methods perform a direct conversion from 8 to 16bits by adding
265 * null characters in the second byte of each character. This will work as expected
266 * for cases where the string contains ASCII data.
267 * As this is non-destructive, the original data can be retrieved by performing
268 * a Copy to an 8-bit descriptor.
270 class TASN1DecTeletexString
273 IMPORT_C TASN1DecTeletexString();
274 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
275 IMPORT_C HBufC* DecodeDERL(const TASN1DecGeneric& Source);
277 IMPORT_C TInt CheckValid(const TDesC8& aSource);
279 HBufC* DecodeContentsL(const TDesC8& aSource);
283 Class used for decoding ASN.1 BMP strings.
285 class TASN1DecBMPString
288 IMPORT_C TASN1DecBMPString();
289 IMPORT_C HBufC* DecodeDERL(const TDesC8& aSource,TInt& aPos);
290 IMPORT_C HBufC* DecodeDERL(const TASN1DecGeneric& aSource);
292 IMPORT_C TInt CheckValid(const TDesC8& aSource);
294 HBufC* DecodeContentsL(const TDesC8& aSource);
297 class TASN1DecSequence
300 IMPORT_C TASN1DecSequence();
301 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TDesC8& aSource,TInt& aPos);
302 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TASN1DecGeneric& aSource);
303 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TDesC8& aSource,TInt& aPos, TInt aMin, TInt aMax);
304 IMPORT_C CArrayPtrFlat<TASN1DecGeneric>* DecodeDERLC(const TASN1DecGeneric& aSource, TInt aMin, TInt aMax);
306 /** @internalComponent */
307 void DecodeContentsL(const TDesC8& aSource, CArrayPtrFlat<TASN1DecGeneric>& aDest);
308 /** @internalComponent */
309 static void CleanupSequence(TAny* aArray);