36 static const TInt KDeviceSpecificKeyLength = 16; |
41 static const TInt KDeviceSpecificKeyLength = 16; |
37 static const TInt KRdbSerialNumberLength = 16; |
42 static const TInt KRdbSerialNumberLength = 16; |
38 |
43 |
39 public: // New functions |
44 public: // New functions |
40 |
45 |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 |
41 virtual ~MDrmKeyStorage() = 0; |
50 virtual ~MDrmKeyStorage() = 0; |
42 |
51 |
|
52 /** |
|
53 * ModulusSize |
|
54 * |
|
55 * Return the modulus size of the selected certificates private key. |
|
56 * |
|
57 * @return Modulus size of the PKI key |
|
58 */ |
|
59 |
43 virtual TInt ModulusSize() = 0; |
60 virtual TInt ModulusSize() = 0; |
44 |
61 |
|
62 /** |
|
63 * SelectTrustedRootL |
|
64 * |
|
65 * Selects the trusted root certificate to be used for operation occurring after |
|
66 * this call |
|
67 * |
|
68 * @param aRootKeyHash Hash of the root key to be used. |
|
69 * @leave Symbian OS error codes |
|
70 */ |
|
71 |
45 virtual void SelectTrustedRootL( |
72 virtual void SelectTrustedRootL( |
46 const TDesC8& aRootKeyHash) = 0; |
73 const TDesC8& aRootKeyHash) = 0; |
47 |
74 |
|
75 /** |
|
76 * SelectedRootIsCmla |
|
77 * |
|
78 * Checks if the selected root is a CMLA root |
|
79 * |
|
80 * @return ETrue if the selected root is a CMLA root |
|
81 * EFalse if the root does not exist or is not a CMLA root |
|
82 */ |
|
83 |
48 virtual TBool SelectedRootIsCmla() = 0; |
84 virtual TBool SelectedRootIsCmla() = 0; |
49 |
85 |
|
86 /** |
|
87 * SelectDefaultRootL |
|
88 * |
|
89 * Selects the default root certificate of the device/keystorage implementation |
|
90 * |
|
91 * @leave Symbian OS error code if the root can't be selected for some reason |
|
92 */ |
|
93 |
50 virtual void SelectDefaultRootL() = 0; |
94 virtual void SelectDefaultRootL() = 0; |
51 |
95 |
|
96 /** |
|
97 * GetTrustedRootsL |
|
98 * |
|
99 * Get a list of unique identifiers for the trusted roots of the |
|
100 * device / keystorage implementation. Generally PKI public key hash values. |
|
101 * |
|
102 * @param aRootList A pointer array of trusted root certificate hash values |
|
103 * or other unique identifiers for the certificates |
|
104 * @leave Symbian OS error codes |
|
105 */ |
|
106 |
52 virtual void GetTrustedRootsL( |
107 virtual void GetTrustedRootsL( |
53 RPointerArray<HBufC8>& aRootList) = 0; |
108 RPointerArray<HBufC8>& aRootList) = 0; |
54 |
109 |
|
110 /** |
|
111 * GetCertificateChainL |
|
112 * |
|
113 * Get the certificate chain of the selected certificate |
|
114 * |
|
115 * @param aRootList A pointer array of certificate hash values |
|
116 * or other unique identifiers for the certificates |
|
117 * in the certificate chain |
|
118 * @leave Symbian OS error codes |
|
119 */ |
|
120 |
55 virtual void GetCertificateChainL( |
121 virtual void GetCertificateChainL( |
56 RPointerArray<HBufC8>& aCertChain) = 0; |
122 RPointerArray<HBufC8>& aCertChain) = 0; |
|
123 |
|
124 /** |
|
125 * RsaSignL |
|
126 * |
|
127 * Create an RSA signature of the buffer given |
|
128 * |
|
129 * @param aInput A descriptor containing the data to be signed |
|
130 * @return Signed buffer. Caller is responsible for freeing it. |
|
131 * @leave Symbian OS error codes |
|
132 */ |
57 |
133 |
58 virtual HBufC8* RsaSignL( |
134 virtual HBufC8* RsaSignL( |
59 const TDesC8& aInput) = 0; |
135 const TDesC8& aInput) = 0; |
60 |
136 |
|
137 /** |
|
138 * RsaDecryptL |
|
139 * |
|
140 * Decrypt the RSA encrypted buffer |
|
141 * |
|
142 * @param aInput A descriptor containing the data to be decrypted |
|
143 * @return Decrypted buffer. Caller is responsible for freeing it. |
|
144 * @leave Symbian OS error codes |
|
145 */ |
|
146 |
61 virtual HBufC8* RsaDecryptL( |
147 virtual HBufC8* RsaDecryptL( |
62 const TDesC8& aInput) = 0; |
148 const TDesC8& aInput) = 0; |
63 |
149 |
|
150 /** |
|
151 * ImportDataL |
|
152 * |
|
153 * Allows the importing of PKI keys into the system |
|
154 * Should import: Private Key, Public Certificate and all |
|
155 * signing certificates for the certificate chain all the way to the root. |
|
156 * |
|
157 * Mostly usable for debugging purposes. Should be used with caution. |
|
158 * |
|
159 * @param aPrivateKey Private key of the imported PKI key. |
|
160 * @param aCertificateChain Public Certificate and signing certificates |
|
161 * @leave Symbian OS error codes |
|
162 */ |
|
163 |
64 virtual void ImportDataL( |
164 virtual void ImportDataL( |
65 const TDesC8& aPrivateKey, |
165 const TDesC8& aPrivateKey, |
66 const RArray<TPtrC8>& aCertificateChain) = 0; |
166 const RArray<TPtrC8>& aCertificateChain) = 0; |
67 |
167 |
|
168 /** |
|
169 * GetDeviceSpecificKeyL |
|
170 * |
|
171 * Get the device specific key/identifier that has a length of |
|
172 * KDeviceSpecificKeyLength. Must return the same value every time. |
|
173 * This method must not require the root to be selected. |
|
174 * |
|
175 * Does not require the selection of |
|
176 * |
|
177 * @param aKey Buffer to fit the bytes of a device specific |
|
178 * unique key / identifier. Must return the same |
|
179 * value every time |
|
180 * @leave Symbian OS error codes |
|
181 */ |
|
182 |
68 virtual void GetDeviceSpecificKeyL( |
183 virtual void GetDeviceSpecificKeyL( |
69 TBuf8<KDeviceSpecificKeyLength>& aKey) = 0; |
184 TBuf8<KDeviceSpecificKeyLength>& aKey) = 0; |
|
185 |
|
186 /** |
|
187 * GetRdbSerialNumberL |
|
188 * |
|
189 * This method fetches a unique serial number for the OMA DRM rights database |
|
190 * currently in use. Does not have to be unique per device, but should return |
|
191 * the same value while the current database is in use. |
|
192 * Should create a new serial number if one does not exists. |
|
193 * |
|
194 * @param aSerialNumber Serial number for the OMA DRM |
|
195 * rights database |
|
196 * @leave Symbian OS error codes |
|
197 */ |
70 |
198 |
71 virtual void GetRdbSerialNumberL( |
199 virtual void GetRdbSerialNumberL( |
72 TBuf8<KRdbSerialNumberLength>& aSerialNumber) = 0; |
200 TBuf8<KRdbSerialNumberLength>& aSerialNumber) = 0; |
73 |
201 |
|
202 /** |
|
203 * GenerateNewRdbSerialNumberL( |
|
204 * |
|
205 * This method creates a new unique serial number for the OMA DRM rights database. |
|
206 * Length of the serial number is defined by KRdbSerialNumberLength constant. |
|
207 * Should be random and must be persisted until a new serial number is generated by |
|
208 * a new call to this method. |
|
209 * |
|
210 * Recommend storing the serial number into the file system or other secure location. |
|
211 * For example under the rightsserver.exe private directory. |
|
212 * |
|
213 * @leave Symbian OS error codes |
|
214 */ |
|
215 |
74 virtual void GenerateNewRdbSerialNumberL() = 0; |
216 virtual void GenerateNewRdbSerialNumberL() = 0; |
75 |
217 |
|
218 /** |
|
219 * UdtEncryptL |
|
220 * |
|
221 * Encrypt the User Data Transfer data. Usable only in the user data transfer use case. |
|
222 * Uses it's own User Data Transfer PKI key. |
|
223 * |
|
224 * @param aInput Input buffer to be encrypted |
|
225 * @return Buffer encrypted with the User Data Transfer specific PKI key. |
|
226 * @leave Symbian OS error codes |
|
227 */ |
|
228 |
76 virtual HBufC8* UdtEncryptL( |
229 virtual HBufC8* UdtEncryptL( |
77 const TDesC8& aInput) = 0; |
230 const TDesC8& aInput) = 0; |
78 |
231 |
|
232 /** |
|
233 * GetRootCertificatesL |
|
234 * |
|
235 * Get a list of all the root certificates of the device. |
|
236 * Returns actual binary format (.der) certificates. |
|
237 * |
|
238 * @param aRootCerts Param description |
|
239 * @return Return value descriptions |
|
240 * @leave Symbian OS error codes |
|
241 */ |
|
242 |
79 virtual void GetRootCertificatesL( |
243 virtual void GetRootCertificatesL( |
80 RPointerArray<HBufC8>& aRootCerts) = 0; |
244 RPointerArray<HBufC8>& aRootCerts) = 0; |
81 |
245 |
|
246 /** |
|
247 * RandomDataGetL |
|
248 * |
|
249 * Get random data into the beginning of the aData buffer. |
|
250 * |
|
251 * @param aData A return buffer that has enough space for the aLength amount of data. |
|
252 * @param aLength Amount of random data requested |
|
253 * @leave Symbian OS error codes |
|
254 */ |
|
255 |
82 virtual void RandomDataGetL( |
256 virtual void RandomDataGetL( |
83 TDes8& aData, |
257 TDes8& aData, |
84 const TInt aLength ) = 0; |
258 const TInt aLength ) = 0; |
85 |
259 |
86 }; |
260 }; |
87 |
261 |
|
262 /** |
|
263 * DrmKeyStorageNewL |
|
264 * |
|
265 * @return Pointer to an object which implements the MDrmKeyStorage |
|
266 * interface. Underlying implementation tells which |
|
267 * keystorage to load if there are emulator/hw specific ones |
|
268 * @leave Symbian OS error codes |
|
269 */ |
|
270 |
88 IMPORT_C MDrmKeyStorage* DrmKeyStorageNewL(); |
271 IMPORT_C MDrmKeyStorage* DrmKeyStorageNewL(); |
89 |
272 |
90 #endif // DRMKEYSTORAGE_H |
273 #endif // DRMKEYSTORAGE_H |
91 |
274 |
92 // End of File |
275 // End of File |