|
1 /* |
|
2 * Copyright (c) 2002-2004 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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef OMACRYPTO_H |
|
21 #define OMACRYPTO_H |
|
22 |
|
23 #include <bigint.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 |
|
27 class CRSAPrivateKey; |
|
28 class CRSAPublicKey; |
|
29 class MDrmKeyStorage; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * OmaCrypto: Contains crypto operations for OMA DRM 2.0 |
|
35 * |
|
36 * @lib - |
|
37 * @since 3.0 |
|
38 */ |
|
39 class OmaCrypto |
|
40 { |
|
41 public: // Constants |
|
42 |
|
43 static const TInt KKeySize = 16; |
|
44 static const TInt KMacSize = 16; |
|
45 static const TInt KWrapBlockSize = 8; |
|
46 static const TInt KWrappedKeySize = KKeySize + KMacSize + KWrapBlockSize; |
|
47 static const TInt KPssSaltLength = 20; |
|
48 |
|
49 public: // New functions |
|
50 |
|
51 IMPORT_C static HBufC8* RsaDecryptL( |
|
52 MDrmKeyStorage* aKeyStorage, |
|
53 const TDesC8& aInput); |
|
54 |
|
55 IMPORT_C static HBufC8* RsaEncryptL( |
|
56 CRSAPublicKey* aKey, |
|
57 const TDesC8& aInput); |
|
58 |
|
59 IMPORT_C static HBufC8* RsaVerifyL( |
|
60 CRSAPublicKey* aKey, |
|
61 const TDesC8& aInput); |
|
62 |
|
63 IMPORT_C static HBufC8* RsaKemKwsEncryptL( |
|
64 CRSAPublicKey* aKey, |
|
65 const TDesC8& aRek, |
|
66 const TDesC8& aMac); |
|
67 |
|
68 IMPORT_C static void RsaKemKwsDecryptL( |
|
69 MDrmKeyStorage* aKeyStorage, |
|
70 const TDesC8& aInput, |
|
71 TDes8& aRek, |
|
72 TDes8& aMac); |
|
73 |
|
74 IMPORT_C static HBufC8* KdfL( |
|
75 const TDesC8& aInput, |
|
76 const TDesC8& aOtherData, |
|
77 TInt aKLen); |
|
78 |
|
79 IMPORT_C static HBufC8* AesWrapL( |
|
80 const TDesC8& aKey, |
|
81 const TDesC8& aInput); |
|
82 |
|
83 IMPORT_C static HBufC8* AesUnwrapL( |
|
84 const TDesC8& aKey, |
|
85 const TDesC8& aInput); |
|
86 |
|
87 IMPORT_C static HBufC8* I2OSPL( |
|
88 RInteger& aInt); |
|
89 |
|
90 IMPORT_C static RInteger OS2IPL( |
|
91 const TDesC8& aOctetStream); |
|
92 |
|
93 IMPORT_C static HBufC8* Mgf1L( |
|
94 const TDesC8& aMfgSeed, |
|
95 TInt aMaskLen); |
|
96 |
|
97 IMPORT_C static HBufC8* RsaPssSignHashL( |
|
98 MDrmKeyStorage* aKeyStorage, |
|
99 const TDesC8& aMHash); |
|
100 |
|
101 IMPORT_C static TBool RsaPssVerifyHashL( |
|
102 CRSAPublicKey* aKey, |
|
103 const TDesC8& aSignature, |
|
104 const TDesC8& aMHash); |
|
105 |
|
106 protected: // New functions |
|
107 |
|
108 IMPORT_C static void WriteUint32ToBlock( |
|
109 TUint32 aInt, |
|
110 TDes8& aBlock, |
|
111 TInt aOffset); |
|
112 }; |
|
113 |
|
114 #endif // OMACRYPTO_H |
|
115 |
|
116 // End of File |