sl@0: /* sl@0: * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: sl@0: #ifndef __PKCS12KDF_H__ sl@0: #define __PKCS12KDF_H__ sl@0: sl@0: #include sl@0: sl@0: class PKCS12KDF sl@0: /** sl@0: Namespace class contains static functions which sl@0: are used to generate a key for PKCS#12 operations. sl@0: sl@0: See Section B from PKCS 12 v1.0. sl@0: */ sl@0: { sl@0: public: sl@0: enum TIDByteType sl@0: /** sl@0: ID byte value used to generate (en|de)cryption key, sl@0: IV, or MAC key. See SB.3 of spec. sl@0: */ sl@0: { sl@0: /** Generates a key for (en|de)cryption. */ sl@0: EIDByteEncryptKey = 1, sl@0: /** Generates an initialization vector. */ sl@0: EIDByteIV = 2, sl@0: /** Generates a key for MAC-ing. */ sl@0: EIDByteMACKey = 3 sl@0: }; sl@0: public: sl@0: IMPORT_C static void DeriveKeyL( sl@0: TDes8& aKey, TIDByteType aIDType, sl@0: const TDesC8& aPasswd, const TDesC8& aSalt, const TUint aIterations); sl@0: IMPORT_C static HBufC8* GeneratePasswordLC(const TDesC& aDes); sl@0: sl@0: private: sl@0: static void Process6cL(TDes8& Ij, const TDesC8& B, TInt v); sl@0: sl@0: #ifdef _DEBUG sl@0: enum TPanic sl@0: { sl@0: EDKEmptyPswd = 0x10, EDKOddPswdByteCount, EDKBadNullTerminator sl@0: }; sl@0: static void Panic(TPanic aPanic); sl@0: #endif sl@0: sl@0: // not implemented - prevents instantiation sl@0: PKCS12KDF(); sl@0: }; sl@0: sl@0: #endif // #ifndef __PKCS12KDF_H__ sl@0: