|
1 /* |
|
2 * Copyright (c) 2000, 2004 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 "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: This file contains the implementation of |
|
15 * CX509CertificateSet class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "CX509CertificateSet.h" |
|
24 |
|
25 |
|
26 |
|
27 // ----------------------------------------------------------------------------- |
|
28 // CX509CertificateSet |
|
29 // Constructor |
|
30 // ----------------------------------------------------------------------------- |
|
31 CX509CertificateSet::CX509CertificateSet( TInt aGranularity ) |
|
32 :CArrayPtrFlat<CX509Certificate>( aGranularity ) |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CX509CertificateSet::ConstructL |
|
38 // ----------------------------------------------------------------------------- |
|
39 |
|
40 void CX509CertificateSet::ConstructL() |
|
41 { |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CX509CertificateSet::NewLC |
|
46 // ----------------------------------------------------------------------------- |
|
47 CX509CertificateSet* CX509CertificateSet::NewLC( TInt aGranularity ) |
|
48 { |
|
49 CX509CertificateSet* self = new (ELeave) CX509CertificateSet(aGranularity); |
|
50 CleanupStack::PushL(self); |
|
51 |
|
52 self->ConstructL(); |
|
53 |
|
54 return self; |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CX509CertificateSet |
|
59 // Destructor |
|
60 // ----------------------------------------------------------------------------- |
|
61 CX509CertificateSet::~CX509CertificateSet() |
|
62 { |
|
63 ResetAndDestroy(); |
|
64 } |
|
65 |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CX509CertificateSet::NewL |
|
69 // ----------------------------------------------------------------------------- |
|
70 CX509CertificateSet* CX509CertificateSet::NewL( TInt aGranularity ) |
|
71 { |
|
72 CX509CertificateSet* self = NewLC( aGranularity ); |
|
73 CleanupStack::Pop(); |
|
74 |
|
75 return self; |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CX509CertificateSet::DecodeCertsL |
|
80 // This function reads binarydata given as parameter and decodes |
|
81 // all certificates from it and puts them into CX509CertificateSet, |
|
82 // what is obviously a set of X509Certificates. |
|
83 // Parameters: const TDesC8& aBinaryData Binarydata containing |
|
84 // CX509Certificates. |
|
85 // Returns: Amount of certificates decoded. |
|
86 // ----------------------------------------------------------------------------- |
|
87 TUint CX509CertificateSet::DecodeCertsL(const TDesC8& aBinaryData) |
|
88 { |
|
89 TInt pos = NULL;//start at the start |
|
90 TUint amount = NULL; |
|
91 |
|
92 while ( pos < aBinaryData.Length() ) |
|
93 { |
|
94 CX509Certificate *aTempCertificate = CX509Certificate::NewLC( aBinaryData, pos ); |
|
95 |
|
96 AppendL( aTempCertificate ); |
|
97 CleanupStack::Pop(); |
|
98 amount++; |
|
99 } |
|
100 |
|
101 return amount; // amount of certificates in CertificateSet |
|
102 } |
|
103 |
|
104 // End of file |
|
105 |