equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 1998-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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "asn1dec.h" |
|
20 |
|
21 EXPORT_C TASN1DecBoolean::TASN1DecBoolean(void) |
|
22 { |
|
23 } |
|
24 |
|
25 EXPORT_C TBool TASN1DecBoolean::DecodeDERL(const TDesC8& aSource,TInt& aPos) |
|
26 |
|
27 { |
|
28 TPtrC8 Ptr=aSource.Right(aSource.Length()-aPos); |
|
29 TASN1DecGeneric gen(Ptr); |
|
30 gen.InitL(); |
|
31 aPos+=gen.LengthDER(); |
|
32 TBool res = DecodeDERL(gen); |
|
33 return res; |
|
34 } |
|
35 |
|
36 EXPORT_C TBool TASN1DecBoolean::DecodeDERL(const TASN1DecGeneric& aSource) |
|
37 |
|
38 { |
|
39 TPtrC8 content = aSource.GetContentDER(); |
|
40 if (content.Length() != 1) |
|
41 { |
|
42 User::Leave(KErrArgument); |
|
43 } |
|
44 if (content[0] == 0) |
|
45 { |
|
46 return EFalse; |
|
47 } |
|
48 if (content[0] == 0xFF) |
|
49 { |
|
50 return ETrue; |
|
51 } |
|
52 User::Leave(KErrArgument); |
|
53 return ETrue;//never gets to here |
|
54 } |