|
1 /* |
|
2 * Copyright (c) 2006 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: The header file of DevTokenDataTypes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __DEVTOKENDATATYPES_H__ |
|
21 #define __DEVTOKENDATATYPES_H__ |
|
22 |
|
23 #include <mctkeystore.h> |
|
24 #include <cctcertinfo.h> |
|
25 #include <bigint.h> |
|
26 |
|
27 /** |
|
28 * Server-side key info. |
|
29 * |
|
30 * This is the server-side counterpart to the CCTKeyInfo class, containing all |
|
31 * the key attributes. |
|
32 |
|
33 * @lib DevTokenShared.dll |
|
34 * @since S60 v3.2 |
|
35 */ |
|
36 class CDevTokenKeyInfo : public CKeyInfoBase |
|
37 { |
|
38 public: |
|
39 // Creates a new CKeyInfo from a stream. |
|
40 IMPORT_C static CDevTokenKeyInfo* NewL(RReadStream& aStream); |
|
41 |
|
42 // Make destructor public again. |
|
43 inline ~CDevTokenKeyInfo(); |
|
44 |
|
45 // Push object onto the cleanup stack (pointer won't convert to CBase* due |
|
46 // to protected inheritance. |
|
47 inline void CleanupPushL(); |
|
48 |
|
49 public: |
|
50 |
|
51 // Get the handle of the key. |
|
52 inline TInt Handle() const; |
|
53 |
|
54 // Set the key access type. |
|
55 inline void SetAccessType(TInt aAccessType); |
|
56 |
|
57 // Set the security policy for key use operations. |
|
58 IMPORT_C void SetUsePolicy(const TSecurityPolicy& aPolicy); |
|
59 |
|
60 // Set the security policy for key management operations. |
|
61 IMPORT_C void SetManagementPolicy(const TSecurityPolicy& aPolicy); |
|
62 |
|
63 // Sets the set of DER encoded PKCS8 attributes. |
|
64 IMPORT_C void SetPKCS8AttributeSet(HBufC8* aPKCS8AttributeSet); |
|
65 |
|
66 private: |
|
67 |
|
68 inline CDevTokenKeyInfo(); |
|
69 }; |
|
70 |
|
71 |
|
72 /** |
|
73 * An internal abstraction for Diffie-Hellman parmeters. |
|
74 * |
|
75 * @lib DevTokenShared.dll |
|
76 * @since S60 v3.2 |
|
77 */ |
|
78 class CDevTokenDHParams : public CBase |
|
79 { |
|
80 public: |
|
81 |
|
82 IMPORT_C static CDevTokenDHParams* NewL(const TInteger& aN, const TInteger& aG); |
|
83 |
|
84 IMPORT_C ~CDevTokenDHParams(); |
|
85 |
|
86 inline const TInteger& N() const; |
|
87 |
|
88 inline const TInteger& G() const; |
|
89 |
|
90 //Return N and release ownership |
|
91 |
|
92 IMPORT_C RInteger TakeN(); |
|
93 |
|
94 //Return G and release ownership |
|
95 |
|
96 IMPORT_C RInteger TakeG(); |
|
97 |
|
98 private: |
|
99 |
|
100 IMPORT_C CDevTokenDHParams(RInteger aN, RInteger aG); |
|
101 |
|
102 RInteger iN; |
|
103 |
|
104 RInteger iG; |
|
105 }; |
|
106 |
|
107 |
|
108 /** A common interface for arrays of key infos. |
|
109 * |
|
110 * @lib DevTokenShared.dll |
|
111 * @since S60 v3.2 |
|
112 */ |
|
113 class MDevTokenKeyInfoArray |
|
114 { |
|
115 public: |
|
116 |
|
117 virtual TInt Count() = 0; |
|
118 |
|
119 virtual CCTKeyInfo* operator[](TInt aIndex) = 0; |
|
120 |
|
121 virtual TInt Append(CCTKeyInfo* aInfo) = 0; |
|
122 |
|
123 virtual void Close() = 0; |
|
124 }; |
|
125 |
|
126 |
|
127 /** |
|
128 * Information sent back to client when a key has been created or imported. |
|
129 * |
|
130 * @lib DevTokenShared.dll |
|
131 * @since S60 v3.2 |
|
132 */ |
|
133 struct TDevTokenKeyUpdate |
|
134 { |
|
135 |
|
136 TInt iReference; |
|
137 |
|
138 TKeyIdentifier iId; |
|
139 |
|
140 TUint iSize; |
|
141 |
|
142 CKeyInfoBase::EKeyAlgorithm iAlgorithm; |
|
143 }; |
|
144 |
|
145 |
|
146 /** |
|
147 * Server-side cert info. |
|
148 * |
|
149 * This is the server-side counterpart to the CCTCertInfo class, containing all |
|
150 * the certificate attributes. |
|
151 * We don't support the issuer hash, as it is not |
|
152 * stored. |
|
153 * |
|
154 * @lib DevTokenShared.dll |
|
155 * @since S60 v3.2 |
|
156 */ |
|
157 |
|
158 class CDevTokenCertInfo : public CBase, public MCertInfo |
|
159 { |
|
160 public: |
|
161 |
|
162 // Copy a CCertInfo. |
|
163 IMPORT_C static CDevTokenCertInfo* NewL(const CDevTokenCertInfo& aOther); |
|
164 |
|
165 // Copy a CCertInfo. |
|
166 IMPORT_C static CDevTokenCertInfo* NewLC(const CDevTokenCertInfo& aOther); |
|
167 |
|
168 // Makes a new CCTCertInfo from its constituent parts. |
|
169 IMPORT_C static CDevTokenCertInfo* NewL(const TDesC& aLabel, |
|
170 TCertificateFormat aFormat, |
|
171 TCertificateOwnerType aCertificateOwnerType, |
|
172 TInt aSize, |
|
173 const TKeyIdentifier* aSubjectKeyId, |
|
174 const TKeyIdentifier* aIssuerKeyId, |
|
175 TInt aCertificateId); |
|
176 |
|
177 IMPORT_C static CDevTokenCertInfo* NewL(const TDesC& aLabel, |
|
178 TCertificateFormat aFormat, |
|
179 TCertificateOwnerType aCertificateOwnerType, |
|
180 TInt aSize, |
|
181 const TKeyIdentifier* aSubjectKeyId, |
|
182 const TKeyIdentifier* aIssuerKeyId, |
|
183 TInt aCertificateId, |
|
184 const TBool aDeletable); |
|
185 |
|
186 // Makes a new CCTCertInfo from its constituent parts. |
|
187 IMPORT_C static CDevTokenCertInfo* NewLC(const TDesC& aLabel, |
|
188 TCertificateFormat aFormat, |
|
189 TCertificateOwnerType aCertificateOwnerType, |
|
190 TInt aSize, |
|
191 const TKeyIdentifier* aSubjectKeyId, |
|
192 const TKeyIdentifier* aIssuerKeyId, |
|
193 TInt aCertificateId); |
|
194 |
|
195 IMPORT_C static CDevTokenCertInfo* NewLC(const TDesC& aLabel, |
|
196 TCertificateFormat aFormat, |
|
197 TCertificateOwnerType aCertificateOwnerType, |
|
198 TInt aSize, |
|
199 const TKeyIdentifier* aSubjectKeyId, |
|
200 const TKeyIdentifier* aIssuerKeyId, |
|
201 TInt aCertificateId, |
|
202 const TBool aDeletable); |
|
203 |
|
204 // Reads a CDevTokenCertInfo from a stream. |
|
205 IMPORT_C static CDevTokenCertInfo* NewL(RReadStream& aStream); |
|
206 |
|
207 // Reads a CCertInfo from a stream. |
|
208 IMPORT_C static CDevTokenCertInfo* NewLC(RReadStream& aStream); |
|
209 |
|
210 // Accessors |
|
211 inline const TDesC& Label() const; |
|
212 |
|
213 inline TInt Reference() const; |
|
214 |
|
215 inline const TKeyIdentifier& SubjectKeyId() const; |
|
216 |
|
217 inline const TKeyIdentifier& IssuerKeyId() const; |
|
218 |
|
219 inline TCertificateFormat CertificateFormat() const; |
|
220 |
|
221 inline TCertificateOwnerType CertificateOwnerType() const; |
|
222 |
|
223 inline TInt Size() const; |
|
224 |
|
225 inline TInt CertificateId() const; |
|
226 |
|
227 inline TBool IsDeletable() const; |
|
228 |
|
229 private: |
|
230 |
|
231 // Default constructor. |
|
232 CDevTokenCertInfo(); |
|
233 |
|
234 // Copy constructor. |
|
235 CDevTokenCertInfo(const CDevTokenCertInfo& aOther); |
|
236 |
|
237 CDevTokenCertInfo(const TDesC& aLabel, |
|
238 TCertificateFormat aFormat, |
|
239 TCertificateOwnerType aCertificateOwnerType, |
|
240 TInt aSize, |
|
241 const TKeyIdentifier* aSubjectKeyId, |
|
242 const TKeyIdentifier* aIssuerKeyId, |
|
243 TInt aCertificateId, |
|
244 const TBool aDeletable = ETrue); |
|
245 }; |
|
246 |
|
247 |
|
248 struct TDevTokenAddCertDataStruct |
|
249 { |
|
250 TCertLabel iLabel; |
|
251 TCertificateFormat iFormat; |
|
252 TCertificateOwnerType iCertificateOwnerType; |
|
253 TKeyIdentifier iSubjectKeyId; |
|
254 TKeyIdentifier iIssuerKeyId; |
|
255 TBool iDeletable; |
|
256 }; |
|
257 |
|
258 #include "DevTokenDataTypes.inl" |
|
259 |
|
260 #endif //__DEVTOKENDATATYPES_H__ |