|
1 /* |
|
2 * Copyright (c) 2002 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 implementation represents one entry in an array |
|
15 * where one mapping contains certificate info |
|
16 * with trusted settings |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include "WimCertStoreMapping.h" |
|
24 #include "WimTrace.h" |
|
25 |
|
26 // ============================ MEMBER FUNCTIONS =============================== |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CWimCertStoreMapping::NewL() |
|
30 // NewL constructor which uses NewLC constructor |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CWimCertStoreMapping* CWimCertStoreMapping::NewL() |
|
34 { |
|
35 _WIMTRACE ( _L( "CWimCertStoreMapping::NewL()" ) ); |
|
36 CWimCertStoreMapping* self = CWimCertStoreMapping::NewLC(); |
|
37 CleanupStack::Pop( self ); |
|
38 return self; |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CWimCertStoreMapping::NewLC() |
|
43 // NewLC constructor pushes pointer to cleanup stack |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 CWimCertStoreMapping* CWimCertStoreMapping::NewLC() |
|
47 { |
|
48 _WIMTRACE ( _L( "CWimCertStoreMapping::NewLC()" ) ); |
|
49 CWimCertStoreMapping* self = new( ELeave ) CWimCertStoreMapping(); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // CWimCertStoreMapping::ConstructL() |
|
57 // Create an array for certificate applications in this mapping |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 void CWimCertStoreMapping::ConstructL() |
|
61 { |
|
62 _WIMTRACE ( _L( "CWimCertStoreMapping::ConstructL()" ) ); |
|
63 iCertificateApps = new( ELeave ) RArray<TUid>(); |
|
64 } |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // CWimCertStoreMapping::CWimCertStoreMapping() |
|
68 // Default constructor. |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CWimCertStoreMapping::CWimCertStoreMapping() |
|
72 { |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CWimCertStoreMapping::~CWimCertStoreMapping() |
|
77 // Destructor |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 CWimCertStoreMapping::~CWimCertStoreMapping() |
|
81 { |
|
82 _WIMTRACE ( _L( "CWimCertStoreMapping::~CWimCertStoreMapping()" ) ); |
|
83 // CCTCertInfo class release is done in CWimCertInfo class |
|
84 iEntry = NULL; |
|
85 |
|
86 if ( iCertificateApps ) |
|
87 { |
|
88 iCertificateApps->Close(); |
|
89 delete iCertificateApps; |
|
90 } |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CWimCertStoreMapping::SetEntryL() |
|
95 // Sets given certificate info into mapping entry |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CWimCertStoreMapping::SetEntryL( CCTCertInfo* aCertInfo ) |
|
99 { |
|
100 _WIMTRACE ( _L( "CWimCertStoreMapping::SetEntryL()" ) ); |
|
101 __ASSERT_ALWAYS( aCertInfo, User::Leave( KErrArgument ) ); |
|
102 |
|
103 if ( iEntry ) |
|
104 { |
|
105 iEntry->Release(); |
|
106 } |
|
107 iEntry = aCertInfo; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CWimCertStoreMapping::SetCertificateAppsL() |
|
112 // Sets certificate applications to mapping entry |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CWimCertStoreMapping::SetCertificateAppsL( RArray<TUid>* aCertificateApps ) |
|
116 { |
|
117 _WIMTRACE ( _L( "CWimCertStoreMapping::SetCertificateAppsL()" ) ); |
|
118 TInt count = aCertificateApps->Count(); |
|
119 for ( TInt i = 0; i < count; i++ ) |
|
120 { |
|
121 __ASSERT_ALWAYS( &aCertificateApps[i], User::Leave( KErrArgument ) ); |
|
122 } |
|
123 iCertificateApps->Close(); |
|
124 delete iCertificateApps; |
|
125 iCertificateApps = aCertificateApps; |
|
126 } |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CWimCertStoreMapping::Entry() const |
|
130 // Returns the certificate part of mapping |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 CCTCertInfo* CWimCertStoreMapping::Entry() const |
|
134 { |
|
135 _WIMTRACE ( _L( "CWimCertStoreMapping::Entry()" ) ); |
|
136 return iEntry; |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CWimCertStoreMapping::CertificateApps() |
|
141 // Returns an array of applications from mapping entry the certificate supports |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 const RArray<TUid>& CWimCertStoreMapping::CertificateApps() const |
|
145 { |
|
146 _WIMTRACE ( _L( "CWimCertStoreMapping::CertificateApps()" ) ); |
|
147 return *iCertificateApps; |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CWimCertStoreMapping::IsApplicable() |
|
152 // Returns boolean value indicating if given applicaton is supported by |
|
153 // the certificate of mapping entry |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 TBool CWimCertStoreMapping::IsApplicable( const TUid& aApplication ) const |
|
157 { |
|
158 _WIMTRACE ( _L( "CWimCertStoreMapping::IsApplicable()" ) ); |
|
159 TInt count = iCertificateApps->Count(); |
|
160 for ( TInt i = 0; i < count; i++ ) |
|
161 { |
|
162 TUid app = ( *iCertificateApps )[i]; |
|
163 if ( app == aApplication ) |
|
164 { |
|
165 return ETrue; |
|
166 } |
|
167 } |
|
168 return EFalse; |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CWimCertStoreMapping::Trusted() |
|
173 // Returns boolean value indicating if the certificate in mapping |
|
174 // entry is trusted |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 TBool CWimCertStoreMapping::Trusted() const |
|
178 { |
|
179 _WIMTRACE ( _L( "CWimCertStoreMapping::Trusted()" ) ); |
|
180 return iTrusted; |
|
181 } |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CWimCertStoreMapping::SetTrusted() |
|
185 // Sets mapping entry to state of trusted or not trusted ( true/false ) |
|
186 // ----------------------------------------------------------------------------- |
|
187 // |
|
188 void CWimCertStoreMapping::SetTrusted( TBool aTrusted ) |
|
189 { |
|
190 _WIMTRACE ( _L( "CWimCertStoreMapping::SetTrusted()" ) ); |
|
191 iTrusted = aTrusted; |
|
192 } |