First public contribution.
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.
15 * This file contains the implementation of the Printable String ASN1 object.
16 * The characters included in this string type are:
17 * AB...Zab...z01...9<space>'()+,-./:?
24 const TInt8 PrintableStringValid[256]=
26 // 0 1 2 3 4 5 6 7 8 9 a b c d e f
27 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0
28 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 1
29 0,0,0,0,0,0,0,1,1,1,0,1,1,1,1,1, // 2
30 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, // 3
31 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 4
32 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, // 5
33 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 6
34 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, // 7
35 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 8
36 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 9
37 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // a
38 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // b
39 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // c
40 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // d
41 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // e
42 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // f
45 EXPORT_C TASN1DecPrintableString::TASN1DecPrintableString(void)
49 TInt TASN1DecPrintableString::CheckValid(const TDesC8& aString)
53 for (i=0;i<aString.Length();i++)
55 if (PrintableStringValid[aString[i]]==0)
63 EXPORT_C HBufC* TASN1DecPrintableString::DecodeDERL(const TDesC8& aSource,TInt& aPos)
66 TPtrC8 Source=aSource.Mid(aPos);
67 TASN1DecGeneric gen(Source);
69 HBufC* res = DecodeContentsL(gen.GetContentDER());
73 EXPORT_C HBufC* TASN1DecPrintableString::DecodeDERL(const TASN1DecGeneric& aSource)
76 return DecodeContentsL(aSource.GetContentDER());
79 HBufC* TASN1DecPrintableString::DecodeContentsL(const TDesC8& aSource)
81 HBufC* res = HBufC::NewL(aSource.Length());
82 TPtr pRes = res->Des();