os/security/crypto/weakcryptospi/source/pbe/pbesymmetricfactory.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2003-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 * PBE symmetric factory
    16 *
    17 */
    18 
    19 
    20 /**
    21  @file 
    22  @internalComponent 
    23 */
    24  
    25 #ifndef __PBESYMMETRICFACTORY_H__
    26 #define __PBESYMMETRICFACTORY_H__
    27 
    28 #include <symmetric.h>
    29 #include <pbe.h>
    30 
    31 const TUint KAESBlockBytes = 16;
    32 const TUint KAESKeyBytes128 = 16;
    33 const TUint KAESKeyBytes192 = 24;
    34 const TUint KAESKeyBytes256 = 32;
    35 
    36 const TUint KDESBlockBytes = 8;
    37 const TUint KDESKeyBytes = 8;
    38 const TUint K3DESKeyBytes = 24;
    39 
    40 const TUint K2Key3DESKeyBytes = 16;
    41 const TUint  KRC4KeyBytes128 = 16;
    42 const TUint  KRC4KeyBytes40 = 5;
    43 
    44 const TUint KRC2BlockBytes = 8;
    45 const TUint KRC2KeyBytes40 = 5;
    46 const TUint KRC2KeyBytes128 = 16;
    47 
    48 const TPBECipher KPBEDefaultStrongCipher = ECipherAES_CBC_128;
    49 const TPBECipher KPBEDefaultWeakCipher = ECipherDES_CBC;
    50 const TUint KPBEDefaultSaltBytes = 16; //pkcs5 recommends min 64 bits (8 bytes);
    51 
    52 const TUint KPBEMaxCipherIVBytes = KAESBlockBytes;
    53 const TUint KPBEMaxCipherKeyBytes = KAESKeyBytes256;
    54 const TUint KPBEMaxSaltBytes = 16; //pkcs5 recommends min 64 bits (8 bytes);
    55 
    56 class PBE
    57 	{
    58 public:
    59 	static TUint GetKeyBytes(TPBECipher aCipher);
    60 	static TUint GetBlockBytes(TPBECipher aCipher);
    61 
    62 	static CSymmetricCipher* MakeEncryptorL(TPBECipher aCipher, 
    63 		const TDesC8& aKey, const TDesC8& aIV);
    64 	static CSymmetricCipher* MakeDecryptorL(TPBECipher aCipher, 
    65 		const TDesC8& aKey, const TDesC8& aIV);
    66 private:
    67 	PBE(void);
    68 	PBE(const PBE&);
    69 	PBE& operator=(const PBE&);	
    70 	};
    71 
    72 #endif