|
1 /* |
|
2 * Copyright (c) 1997-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 |
|
20 #include <wtlskeys.h> |
|
21 #include "wtlsdec.h" |
|
22 #include <bigint.h> |
|
23 |
|
24 EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewL(const TDesC8& aBinaryData) |
|
25 { |
|
26 TInt pos = 0; |
|
27 return CWTLSRSAPublicKey::NewL(aBinaryData, pos); |
|
28 } |
|
29 |
|
30 EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewLC(const TDesC8& aBinaryData) |
|
31 { |
|
32 TInt pos = 0; |
|
33 return CWTLSRSAPublicKey::NewLC(aBinaryData, pos); |
|
34 } |
|
35 |
|
36 EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewL(const TDesC8& aBinaryData, TInt& aPos) |
|
37 { |
|
38 CWTLSRSAPublicKey* self = CWTLSRSAPublicKey::NewLC(aBinaryData, aPos); |
|
39 CleanupStack::Pop(); |
|
40 return self; |
|
41 } |
|
42 |
|
43 EXPORT_C CWTLSRSAPublicKey* CWTLSRSAPublicKey::NewLC(const TDesC8& aBinaryData, TInt& aPos) |
|
44 { |
|
45 CWTLSRSAPublicKey* self = new(ELeave) CWTLSRSAPublicKey; |
|
46 CleanupStack::PushL(self); |
|
47 self->ConstructL(aBinaryData, aPos); |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 void CWTLSRSAPublicKey::ConstructL(const TDesC8& aBinaryData, TInt& aPos) |
|
53 { |
|
54 TWTLSDecUnsignedInteger decInt; |
|
55 TInt expLength = decInt.DecodeShortL(aBinaryData, aPos, 2); |
|
56 iE = decInt.DecodeLongL(aBinaryData, aPos, expLength); |
|
57 TInt modLength = decInt.DecodeShortL(aBinaryData, aPos, 2); |
|
58 iN = decInt.DecodeLongL(aBinaryData, aPos, modLength); |
|
59 } |
|
60 |
|
61 CWTLSRSAPublicKey::CWTLSRSAPublicKey() |
|
62 {} |