sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* PBE symmetric factory
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file
|
sl@0
|
22 |
@internalComponent
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#ifndef __PBESYMMETRICFACTORY_H__
|
sl@0
|
26 |
#define __PBESYMMETRICFACTORY_H__
|
sl@0
|
27 |
|
sl@0
|
28 |
#include <symmetric.h>
|
sl@0
|
29 |
#include <pbe.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
const TUint KAESBlockBytes = 16;
|
sl@0
|
32 |
const TUint KAESKeyBytes128 = 16;
|
sl@0
|
33 |
const TUint KAESKeyBytes192 = 24;
|
sl@0
|
34 |
const TUint KAESKeyBytes256 = 32;
|
sl@0
|
35 |
|
sl@0
|
36 |
const TUint KDESBlockBytes = 8;
|
sl@0
|
37 |
const TUint KDESKeyBytes = 8;
|
sl@0
|
38 |
const TUint K3DESKeyBytes = 24;
|
sl@0
|
39 |
|
sl@0
|
40 |
const TUint K2Key3DESKeyBytes = 16;
|
sl@0
|
41 |
const TUint KRC4KeyBytes128 = 16;
|
sl@0
|
42 |
const TUint KRC4KeyBytes40 = 5;
|
sl@0
|
43 |
|
sl@0
|
44 |
const TUint KRC2BlockBytes = 8;
|
sl@0
|
45 |
const TUint KRC2KeyBytes40 = 5;
|
sl@0
|
46 |
const TUint KRC2KeyBytes128 = 16;
|
sl@0
|
47 |
|
sl@0
|
48 |
const TPBECipher KPBEDefaultStrongCipher = ECipherAES_CBC_128;
|
sl@0
|
49 |
const TPBECipher KPBEDefaultWeakCipher = ECipherDES_CBC;
|
sl@0
|
50 |
const TUint KPBEDefaultSaltBytes = 16; //pkcs5 recommends min 64 bits (8 bytes);
|
sl@0
|
51 |
|
sl@0
|
52 |
const TUint KPBEMaxCipherIVBytes = KAESBlockBytes;
|
sl@0
|
53 |
const TUint KPBEMaxCipherKeyBytes = KAESKeyBytes256;
|
sl@0
|
54 |
const TUint KPBEMaxSaltBytes = 16; //pkcs5 recommends min 64 bits (8 bytes);
|
sl@0
|
55 |
|
sl@0
|
56 |
class PBE
|
sl@0
|
57 |
{
|
sl@0
|
58 |
public:
|
sl@0
|
59 |
static TUint GetKeyBytes(TPBECipher aCipher);
|
sl@0
|
60 |
static TUint GetBlockBytes(TPBECipher aCipher);
|
sl@0
|
61 |
|
sl@0
|
62 |
static CSymmetricCipher* MakeEncryptorL(TPBECipher aCipher,
|
sl@0
|
63 |
const TDesC8& aKey, const TDesC8& aIV);
|
sl@0
|
64 |
static CSymmetricCipher* MakeDecryptorL(TPBECipher aCipher,
|
sl@0
|
65 |
const TDesC8& aKey, const TDesC8& aIV);
|
sl@0
|
66 |
private:
|
sl@0
|
67 |
PBE(void);
|
sl@0
|
68 |
PBE(const PBE&);
|
sl@0
|
69 |
PBE& operator=(const PBE&);
|
sl@0
|
70 |
};
|
sl@0
|
71 |
|
sl@0
|
72 |
#endif
|