sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "pkixcertstate.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
//********************************************************************************//
|
sl@0
|
22 |
CPKIXValidationState* CPKIXValidationState::NewL( const TTime aValidationTime, TInt aChainLength,
|
sl@0
|
23 |
const CArrayPtr<HBufC>* aInitialPolicies)
|
sl@0
|
24 |
{
|
sl@0
|
25 |
CPKIXValidationState* s = CPKIXValidationState::NewLC(aValidationTime, aChainLength, aInitialPolicies);
|
sl@0
|
26 |
CleanupStack::Pop();
|
sl@0
|
27 |
return s;
|
sl@0
|
28 |
}
|
sl@0
|
29 |
|
sl@0
|
30 |
CPKIXValidationState* CPKIXValidationState::NewLC( const TTime aValidationTime, TInt aChainLength,
|
sl@0
|
31 |
const CArrayPtr<HBufC>* aInitialPolicies)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
CPKIXValidationState* s = new(ELeave) CPKIXValidationState(aValidationTime, aChainLength, aInitialPolicies);
|
sl@0
|
34 |
CleanupStack::PushL(s);
|
sl@0
|
35 |
s->ConstructL();
|
sl@0
|
36 |
return s;
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
CPKIXValidationState::~CPKIXValidationState()
|
sl@0
|
40 |
{
|
sl@0
|
41 |
if (iAuthorityConstrainedPolicies != NULL)
|
sl@0
|
42 |
{
|
sl@0
|
43 |
iAuthorityConstrainedPolicies->ResetAndDestroy();
|
sl@0
|
44 |
}
|
sl@0
|
45 |
delete iAuthorityConstrainedPolicies;
|
sl@0
|
46 |
|
sl@0
|
47 |
if (iUserPolicies != NULL)
|
sl@0
|
48 |
{
|
sl@0
|
49 |
iUserPolicies->ResetAndDestroy();
|
sl@0
|
50 |
}
|
sl@0
|
51 |
delete iUserPolicies;
|
sl@0
|
52 |
|
sl@0
|
53 |
if (iMappedPolicies != NULL)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
iMappedPolicies->ResetAndDestroy();
|
sl@0
|
56 |
}
|
sl@0
|
57 |
delete iMappedPolicies;
|
sl@0
|
58 |
|
sl@0
|
59 |
if (iExcludedDNSubtrees != NULL)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
iExcludedDNSubtrees->ResetAndDestroy();
|
sl@0
|
62 |
}
|
sl@0
|
63 |
delete iExcludedDNSubtrees;
|
sl@0
|
64 |
|
sl@0
|
65 |
if (iPermittedDNSubtrees != NULL)
|
sl@0
|
66 |
{
|
sl@0
|
67 |
iPermittedDNSubtrees->ResetAndDestroy();
|
sl@0
|
68 |
}
|
sl@0
|
69 |
delete iPermittedDNSubtrees;
|
sl@0
|
70 |
|
sl@0
|
71 |
if (iExcludedRFC822Subtrees != NULL)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
iExcludedRFC822Subtrees->ResetAndDestroy();
|
sl@0
|
74 |
}
|
sl@0
|
75 |
delete iExcludedRFC822Subtrees;
|
sl@0
|
76 |
|
sl@0
|
77 |
if (iPermittedRFC822Subtrees != NULL)
|
sl@0
|
78 |
{
|
sl@0
|
79 |
iPermittedRFC822Subtrees->ResetAndDestroy();
|
sl@0
|
80 |
}
|
sl@0
|
81 |
delete iPermittedRFC822Subtrees;
|
sl@0
|
82 |
|
sl@0
|
83 |
if (iExcludedDNSNameSubtrees != NULL)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
iExcludedDNSNameSubtrees->ResetAndDestroy();
|
sl@0
|
86 |
}
|
sl@0
|
87 |
delete iExcludedDNSNameSubtrees;
|
sl@0
|
88 |
|
sl@0
|
89 |
if (iPermittedDNSNameSubtrees != NULL)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
iPermittedDNSNameSubtrees->ResetAndDestroy();
|
sl@0
|
92 |
}
|
sl@0
|
93 |
delete iPermittedDNSNameSubtrees;
|
sl@0
|
94 |
|
sl@0
|
95 |
if (iExcludedIPAddressSubtrees != NULL)
|
sl@0
|
96 |
{
|
sl@0
|
97 |
iExcludedIPAddressSubtrees->ResetAndDestroy();
|
sl@0
|
98 |
}
|
sl@0
|
99 |
delete iExcludedIPAddressSubtrees;
|
sl@0
|
100 |
|
sl@0
|
101 |
if (iPermittedIPAddressSubtrees != NULL)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
iPermittedIPAddressSubtrees->ResetAndDestroy();
|
sl@0
|
104 |
}
|
sl@0
|
105 |
delete iPermittedIPAddressSubtrees;
|
sl@0
|
106 |
delete iCriticalExts;
|
sl@0
|
107 |
}
|
sl@0
|
108 |
|
sl@0
|
109 |
CPKIXValidationState::CPKIXValidationState( const TTime aValidationTime, TInt aChainLength,
|
sl@0
|
110 |
const CArrayPtr<HBufC>* aInitialPolicies)
|
sl@0
|
111 |
:iValidationTime(aValidationTime), iPolicyMapping(aChainLength), iPolicyRequired(aChainLength),
|
sl@0
|
112 |
iMaxPathLength(aChainLength), iPos(aChainLength-1), iAnyAuthorityPolicy(ETrue)
|
sl@0
|
113 |
{
|
sl@0
|
114 |
// iUserConstrainedPolicies only set if we have any
|
sl@0
|
115 |
if (aInitialPolicies && aInitialPolicies->Count() != 0)
|
sl@0
|
116 |
{
|
sl@0
|
117 |
iUserConstrainedPolicies = aInitialPolicies;
|
sl@0
|
118 |
}
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
void CPKIXValidationState::ConstructL()
|
sl@0
|
122 |
{
|
sl@0
|
123 |
iAuthorityConstrainedPolicies = new(ELeave) CArrayPtrFlat<CX509CertPolicyInfo> (1);
|
sl@0
|
124 |
iUserPolicies = new(ELeave) CArrayPtrFlat<HBufC> (1);
|
sl@0
|
125 |
iMappedPolicies = new(ELeave) CArrayPtrFlat<CX509PolicyMapping> (1);
|
sl@0
|
126 |
iExcludedDNSubtrees = new(ELeave) CArrayPtrFlat<CX500DistinguishedName> (1);
|
sl@0
|
127 |
iPermittedDNSubtrees = new(ELeave) CArrayPtrFlat<CX500DistinguishedName> (1);
|
sl@0
|
128 |
iExcludedRFC822Subtrees = new(ELeave) CArrayPtrFlat<CX509DomainName> (1);
|
sl@0
|
129 |
iPermittedRFC822Subtrees = new(ELeave) CArrayPtrFlat<CX509DomainName> (1);
|
sl@0
|
130 |
iExcludedDNSNameSubtrees = new(ELeave) CArrayPtrFlat<CX509DomainName> (1);
|
sl@0
|
131 |
iPermittedDNSNameSubtrees = new(ELeave) CArrayPtrFlat<CX509DomainName> (1);
|
sl@0
|
132 |
iExcludedIPAddressSubtrees = new(ELeave) CArrayPtrFlat<CX509IPSubnetMask> (1);
|
sl@0
|
133 |
iPermittedIPAddressSubtrees = new(ELeave) CArrayPtrFlat<CX509IPSubnetMask> (1);
|
sl@0
|
134 |
iCriticalExts = new(ELeave) CArrayPtrFlat<CX509CertExtension> (1);
|
sl@0
|
135 |
//copy the user-supplied policies into userpolicies
|
sl@0
|
136 |
if (iUserConstrainedPolicies)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
TInt userPolicyCount = iUserConstrainedPolicies->Count();
|
sl@0
|
139 |
for (TInt i = 0; i < userPolicyCount; i++)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
HBufC* policy = iUserConstrainedPolicies->At(i)->AllocL();
|
sl@0
|
142 |
CleanupStack::PushL(policy);
|
sl@0
|
143 |
iUserPolicies->AppendL(policy);
|
sl@0
|
144 |
CleanupStack::Pop();
|
sl@0
|
145 |
}
|
sl@0
|
146 |
}
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
|