19
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-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 the License "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:
|
|
15 |
* hash shim classes definition
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file
|
|
22 |
@internalComponent
|
|
23 |
@released
|
|
24 |
*/
|
|
25 |
|
|
26 |
#ifndef __HASHSHIM_H__
|
|
27 |
#define __HASHSHIM_H__
|
|
28 |
|
|
29 |
#include <e32def.h>
|
|
30 |
#include <hash.h>
|
|
31 |
#include <cryptospi/cryptohashapi.h>
|
|
32 |
#include "keys.h"
|
|
33 |
|
|
34 |
#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
|
|
35 |
#include <cryptospi/cryptomacapi.h>
|
|
36 |
#endif
|
|
37 |
|
|
38 |
//
|
|
39 |
// MD2 shim class
|
|
40 |
//
|
|
41 |
NONSHARABLE_CLASS(CMD2Shim) : public CMD2
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
|
|
45 |
static CMD2Shim* NewL();
|
|
46 |
static CMD2Shim* NewLC();
|
|
47 |
~CMD2Shim();
|
|
48 |
CMessageDigest* CopyL();
|
|
49 |
TInt BlockSize();
|
|
50 |
TInt HashSize() ;
|
|
51 |
void Update(const TDesC8& aMessage);
|
|
52 |
TPtrC8 Final(const TDesC8& aMessage);
|
|
53 |
TPtrC8 Final();
|
|
54 |
void Reset();
|
|
55 |
TPtrC8 Hash(const TDesC8& aMessage);
|
|
56 |
CMessageDigest* ReplicateL();
|
|
57 |
|
|
58 |
protected:
|
|
59 |
//virtual from CBase
|
|
60 |
virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
|
|
61 |
|
|
62 |
private:
|
|
63 |
CMD2Shim();
|
|
64 |
void ConstructL();
|
|
65 |
|
|
66 |
private:
|
|
67 |
CryptoSpi::CHash* iHashImpl;
|
|
68 |
};
|
|
69 |
|
|
70 |
|
|
71 |
//
|
|
72 |
// MD5 shim class
|
|
73 |
//
|
|
74 |
|
|
75 |
NONSHARABLE_CLASS(CMD5Shim) : public CMD5
|
|
76 |
{
|
|
77 |
public:
|
|
78 |
static CMD5Shim* NewL();
|
|
79 |
static CMD5Shim* NewLC();
|
|
80 |
~CMD5Shim();
|
|
81 |
CMessageDigest* CopyL();
|
|
82 |
TInt BlockSize();
|
|
83 |
TInt HashSize() ;
|
|
84 |
void Update(const TDesC8& aMessage);
|
|
85 |
TPtrC8 Final(const TDesC8& aMessage);
|
|
86 |
TPtrC8 Final();
|
|
87 |
void Reset();
|
|
88 |
TPtrC8 Hash(const TDesC8& aMessage);
|
|
89 |
CMessageDigest* ReplicateL();
|
|
90 |
|
|
91 |
protected:
|
|
92 |
//virtual from CBase
|
|
93 |
virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
|
|
94 |
|
|
95 |
private:
|
|
96 |
CMD5Shim();
|
|
97 |
void ConstructL();
|
|
98 |
|
|
99 |
private:
|
|
100 |
CryptoSpi::CHash* iHashImpl;
|
|
101 |
};
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
//
|
|
106 |
// SHA1 shim class
|
|
107 |
//
|
|
108 |
|
|
109 |
NONSHARABLE_CLASS(CSHA1Shim) : public CSHA1
|
|
110 |
{
|
|
111 |
public:
|
|
112 |
static CSHA1Shim* NewL();
|
|
113 |
static CSHA1Shim* NewLC();
|
|
114 |
~CSHA1Shim();
|
|
115 |
CMessageDigest* CopyL();
|
|
116 |
TInt BlockSize();
|
|
117 |
TInt HashSize() ;
|
|
118 |
void Update(const TDesC8& aMessage);
|
|
119 |
TPtrC8 Final(const TDesC8& aMessage);
|
|
120 |
TPtrC8 Final();
|
|
121 |
void Reset();
|
|
122 |
TPtrC8 Hash(const TDesC8& aMessage);
|
|
123 |
CMessageDigest* ReplicateL();
|
|
124 |
|
|
125 |
protected:
|
|
126 |
//virtual from CBase
|
|
127 |
virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
|
|
128 |
|
|
129 |
private:
|
|
130 |
CSHA1Shim();
|
|
131 |
void ConstructL();
|
|
132 |
|
|
133 |
private:
|
|
134 |
CryptoSpi::CHash* iHashImpl;
|
|
135 |
};
|
|
136 |
|
|
137 |
//
|
|
138 |
// SHA2 shim class
|
|
139 |
//
|
|
140 |
|
|
141 |
NONSHARABLE_CLASS(CSHA2Shim) : public CSHA2
|
|
142 |
{
|
|
143 |
public:
|
|
144 |
static CSHA2Shim* NewL(TSH2Algo aAlgorithmId);
|
|
145 |
static CSHA2Shim* NewLC(TSH2Algo aAlgorithmId);
|
|
146 |
~CSHA2Shim();
|
|
147 |
CMessageDigest* CopyL();
|
|
148 |
TInt BlockSize();
|
|
149 |
TInt HashSize() ;
|
|
150 |
void Update(const TDesC8& aMessage);
|
|
151 |
TPtrC8 Final(const TDesC8& aMessage);
|
|
152 |
TPtrC8 Final();
|
|
153 |
void Reset();
|
|
154 |
TPtrC8 Hash(const TDesC8& aMessage);
|
|
155 |
CMessageDigest* ReplicateL();
|
|
156 |
|
|
157 |
protected:
|
|
158 |
//virtual from CBase
|
|
159 |
virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
|
|
160 |
|
|
161 |
private:
|
|
162 |
CSHA2Shim();
|
|
163 |
void ConstructL(TSH2Algo aAlgorithmId);
|
|
164 |
|
|
165 |
private:
|
|
166 |
CryptoSpi::CHash* iHashImpl;
|
|
167 |
};
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
//
|
|
172 |
// HMac shim class
|
|
173 |
//
|
|
174 |
|
|
175 |
NONSHARABLE_CLASS(CHMACShim) : public CHMAC
|
|
176 |
{
|
|
177 |
public:
|
|
178 |
static CHMACShim* NewL(const TDesC8& aKey, CMessageDigest* aDigest);
|
|
179 |
static CHMACShim* NewLC(const TDesC8& aKey, CMessageDigest* aDigest);
|
|
180 |
~CHMACShim();
|
|
181 |
CMessageDigest* CopyL();
|
|
182 |
TInt BlockSize();
|
|
183 |
TInt HashSize() ;
|
|
184 |
void Update(const TDesC8& aMessage);
|
|
185 |
TPtrC8 Final(const TDesC8& aMessage);
|
|
186 |
TPtrC8 Final();
|
|
187 |
void Reset();
|
|
188 |
TPtrC8 Hash(const TDesC8& aMessage);
|
|
189 |
CMessageDigest* ReplicateL();
|
|
190 |
|
|
191 |
private:
|
|
192 |
|
|
193 |
#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
|
|
194 |
CHMACShim(CryptoSpi::CMac* aImpl, CMessageDigest* aDigest, CryptoSpi::CKey* aKey, TUid aAlgorithmUid);
|
|
195 |
#else
|
|
196 |
CHMACShim(CryptoSpi::CHash* aImpl, CMessageDigest* aDigest);
|
|
197 |
#endif
|
|
198 |
CHMACShim();
|
|
199 |
void ConstructL(const TDesC8& aKey, TUid aAlgorithmUid, CMessageDigest* aDigest);
|
|
200 |
|
|
201 |
private:
|
|
202 |
|
|
203 |
#ifdef SYMBIAN_SDP_IPSEC_VOIP_SUPPORT
|
|
204 |
CryptoSpi::CMac* iMacImpl;
|
|
205 |
CryptoSpi::CKey* iKey;
|
|
206 |
TUid iAlgorithmUid;
|
|
207 |
#else
|
|
208 |
CryptoSpi::CHash* iMacImpl;
|
|
209 |
#endif
|
|
210 |
};
|
|
211 |
|
|
212 |
//
|
|
213 |
// MD4 shim class
|
|
214 |
//
|
|
215 |
|
|
216 |
NONSHARABLE_CLASS(CMD4Shim) : public CMD4
|
|
217 |
{
|
|
218 |
public:
|
|
219 |
static CMD4Shim* NewL();
|
|
220 |
static CMD4Shim* NewLC();
|
|
221 |
~CMD4Shim();
|
|
222 |
CMessageDigest* CopyL();
|
|
223 |
TInt BlockSize();
|
|
224 |
TInt HashSize();
|
|
225 |
void Update(const TDesC8& aMessage);
|
|
226 |
TPtrC8 Final(const TDesC8& aMessage);
|
|
227 |
TPtrC8 Final();
|
|
228 |
void Reset();
|
|
229 |
TPtrC8 Hash(const TDesC8& aMessage);
|
|
230 |
CMessageDigest* ReplicateL();
|
|
231 |
|
|
232 |
protected:
|
|
233 |
//virtual from CBase
|
|
234 |
virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
|
|
235 |
|
|
236 |
private:
|
|
237 |
CMD4Shim();
|
|
238 |
void ConstructL();
|
|
239 |
|
|
240 |
private:
|
|
241 |
CryptoSpi::CHash* iHashImpl;
|
|
242 |
};
|
|
243 |
|
|
244 |
#endif // __HASHSHIM_H__
|