|
1 /* |
|
2 * Copyright (c) 2002-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 "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: WIM Certificate handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CWIMCERTHANDLER_H |
|
21 #define CWIMCERTHANDLER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "WimClsv.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CWimMemMgmt; |
|
28 class CWimUtilityFuncs; |
|
29 |
|
30 // CLASS DECLARATION |
|
31 |
|
32 /** |
|
33 * Class for handling certificates in WIM card |
|
34 * |
|
35 * @since Series60 2.1 |
|
36 */ |
|
37 class CWimCertHandler : public CBase |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 |
|
41 /** |
|
42 * Two-phased constructor. |
|
43 */ |
|
44 static CWimCertHandler* NewL(); |
|
45 |
|
46 /** |
|
47 * Destructor. |
|
48 */ |
|
49 virtual ~CWimCertHandler(); |
|
50 |
|
51 public: // New functions |
|
52 |
|
53 /** |
|
54 * Fetches certificates from WIM card. |
|
55 * @param aMessage Encapsulates a client request. |
|
56 * @param aWimMgmt Pointer to WIM reference management class. |
|
57 */ |
|
58 void GetCertificatesFromWimL( const RMessage2& aMessage, |
|
59 CWimMemMgmt* aWimMgmt ); |
|
60 |
|
61 /** |
|
62 * Fetches certificate extra information from WIM card. |
|
63 * Extra information includes trusted usage and CDF referense |
|
64 * information. |
|
65 * @param aMessage Encapsulates a client request. |
|
66 * @param aWimMgmt Pointer to WIM reference management class. |
|
67 */ |
|
68 void GetExtrasFromWimL( const RMessage2& aMessage, |
|
69 CWimMemMgmt* aWimMgmt ); |
|
70 |
|
71 /** |
|
72 * Fetches count of certicates in certain WIM card. |
|
73 * @param aMessage Encapsulates a client request. |
|
74 * @param aWimMgmt Pointer to WIM reference management class. |
|
75 */ |
|
76 void GetCerticateCountL( const RMessage2& aMessage, |
|
77 CWimMemMgmt* aWimMgmt ) const; |
|
78 |
|
79 |
|
80 /** |
|
81 * Stores certificate to the WIM card. |
|
82 * @since Series60 2.6 |
|
83 * @param aRequest Enumerator used in message |
|
84 passing between client and server. |
|
85 * @param aMessage Encapsulates a client request. |
|
86 */ |
|
87 void StoreCertificateL( TWimServRqst aRequest, |
|
88 const RMessage2& aMessage ) const; |
|
89 |
|
90 /** |
|
91 * Removes certificate from a WIM card. |
|
92 * @since Series60 2.6 |
|
93 * @param aMessage Encapsulates a client request. |
|
94 * @param aWimMgmt Pointer to WIM reference management class. |
|
95 */ |
|
96 void RemoveCertificateL( const RMessage2& aMessage, |
|
97 CWimMemMgmt* aWimMgmt ) const; |
|
98 |
|
99 /** |
|
100 * Fetches certificate details. |
|
101 * @param aOpCode Enumerator used in message |
|
102 passing between client and server. |
|
103 * @param aMessage Encapsulates a client request. |
|
104 */ |
|
105 void GetCertificateDetailsL( TWimServRqst aOpCode, |
|
106 const RMessage2& aMessage ) ; |
|
107 |
|
108 /** |
|
109 * Exports Public Key of certificate |
|
110 * @since Series60 2.6 |
|
111 * @param aMessage Encapsulates a client request. |
|
112 */ |
|
113 void ExportPublicKeyL( const RMessage2& aMessage ) const; |
|
114 |
|
115 |
|
116 TBool SanityCheck( TUint32 aCertRef ); |
|
117 |
|
118 TBool CheckReadCapsForUsage( const RMessage2& aMsg, |
|
119 TUint8 aUsage ); |
|
120 |
|
121 |
|
122 WIMI_STAT ResolveCertUsage( const RMessage2& aMsg, |
|
123 TUint8& aUsage ); |
|
124 |
|
125 WIMI_STAT GetCertificateInfo( WIMI_Ref_pt aCertRef, |
|
126 TUint8& aUsage ); |
|
127 private: |
|
128 |
|
129 CWimCertHandler(); |
|
130 void ConstructL(); |
|
131 |
|
132 /** |
|
133 * Fetches certificate from the WIM card. |
|
134 * @param aTmpWimRef Reference(id) of certain WIM card. |
|
135 * @param aUsage Certificate usage. Client/CA. |
|
136 * @param aCertNum Certificate number. |
|
137 * @param aCertRefLst Pointer to certificate reference list. |
|
138 * @param aCertInfoLst Pointer to certificate info list. |
|
139 * @param aMessage Encapsulates a client request. |
|
140 * @return Status returned by WIMI. See in wimclsv.h. |
|
141 */ |
|
142 WIMI_STAT GetCertificateFromWimRefL( WIMI_Ref_t* aTmpWimRef, |
|
143 TInt8 aUsage, |
|
144 TUint8& aCertNum, |
|
145 TUint32* aCertRefLst, |
|
146 TWimCertInfo* aCertInfoLst, |
|
147 const RMessage2& aMessage ); |
|
148 |
|
149 /** |
|
150 * Copies certificate information to client's allocated memory area. |
|
151 * @param aCertInfo Certificate information to be copied. |
|
152 * @param aCert Certificate reference. |
|
153 * @param aMessage Encapsulates a client request. |
|
154 * @return TInt KErrNone or KErrArgument |
|
155 */ |
|
156 TInt CopyCertificateInfo( TWimCertInfo& aCertInfo, |
|
157 WIMI_Ref_t* aCert, |
|
158 const RMessage2& aMessage ); |
|
159 |
|
160 /** |
|
161 * Fetches certificate extra information from the WIM card. |
|
162 * @param aTmpWimRef Reference(id) of certain WIM card. |
|
163 * @param aUsage Certificate usage. Client/CA. |
|
164 * @param aKeyHash Certificate key hash. |
|
165 * @param aMessage Encapsulates a client request. |
|
166 * @return Status returned by WIMI. See in WimClsv.h. |
|
167 */ |
|
168 WIMI_STAT GetExtrasFromWimRefL( WIMI_Ref_t* aTmpWimRef, |
|
169 TInt8 aUsage, |
|
170 TDesC8& aKeyHash, |
|
171 const RMessage2& aMessage ); |
|
172 |
|
173 /** |
|
174 * Copies certificate extra information to client's allocated |
|
175 * memory area. Extra information includes trusted usage OID's |
|
176 * and certificate location information. |
|
177 * @param aCert Certificate reference. |
|
178 * @param aMessage Encapsulates a client request. |
|
179 */ |
|
180 void CopyCertExtrasInfoL( WIMI_Ref_t* aCert, |
|
181 const RMessage2& aMessage ); |
|
182 |
|
183 /** |
|
184 * Get count of certificates in WIM |
|
185 * @param aRef WIM card reference pointer. |
|
186 * @param aCertCount Count of certificates in WIM card pointed by aRef |
|
187 * @param aUsage Certificate usage. |
|
188 * @return Status returned by WIMI. See in wimclsv.h. |
|
189 */ |
|
190 WIMI_STAT GetCertificateCountByWIM( WIMI_Ref_t* aRef, |
|
191 TUint8& aCertCount, |
|
192 TUint8 aUsage ) const; |
|
193 |
|
194 /** |
|
195 * Parse Public Key from certificate. |
|
196 * @since Series60 2.6 |
|
197 * @param aCertData Certificate binary data |
|
198 * @param aPublicKey Public Key |
|
199 * @param aCertType Certificate type (X509/WTLS) |
|
200 */ |
|
201 void ParseCertPublicKeyL( const TDesC8& aCertData, |
|
202 TDes8& aPublicKey, |
|
203 const TUint8 aCertType ) const; |
|
204 |
|
205 |
|
206 private: // Data |
|
207 CWimUtilityFuncs* iWimUtilFuncs; |
|
208 RArray<TUint32> iCertRefLst; |
|
209 }; |
|
210 |
|
211 #endif // CWIMCERTHANDLER_H |
|
212 |
|
213 //End of File |