os/security/crypto/weakcrypto/inc/pkcs12kdf.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcrypto/inc/pkcs12kdf.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,75 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @publishedPartner
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +
    1.29 +#ifndef __PKCS12KDF_H__
    1.30 +#define __PKCS12KDF_H__
    1.31 +
    1.32 +#include <e32std.h>
    1.33 +
    1.34 +class PKCS12KDF
    1.35 +/**
    1.36 +	Namespace class contains static functions which
    1.37 +	are used to generate a key for PKCS#12 operations.
    1.38 +	
    1.39 +	See Section B from PKCS 12 v1.0.
    1.40 + */
    1.41 +	{
    1.42 +public:
    1.43 +	enum TIDByteType
    1.44 +	/**
    1.45 +		ID byte value used to generate (en|de)cryption key,
    1.46 +		IV, or MAC key.  See SB.3 of spec.
    1.47 +	 */
    1.48 +		{
    1.49 +		/** Generates a key for (en|de)cryption. */
    1.50 +		EIDByteEncryptKey = 1,
    1.51 +		/** Generates an initialization vector. */
    1.52 +		EIDByteIV = 2,
    1.53 +		/** Generates a key for MAC-ing. */
    1.54 +		EIDByteMACKey = 3
    1.55 +		};
    1.56 +public:
    1.57 +	IMPORT_C static void DeriveKeyL(
    1.58 +		TDes8& aKey, TIDByteType aIDType,
    1.59 +		const TDesC8& aPasswd, const TDesC8& aSalt, const TUint aIterations);
    1.60 +	IMPORT_C static HBufC8* GeneratePasswordLC(const TDesC& aDes);
    1.61 +
    1.62 +private:
    1.63 +	static void Process6cL(TDes8& Ij, const TDesC8& B, TInt v);
    1.64 +
    1.65 +#ifdef _DEBUG
    1.66 +	enum TPanic
    1.67 +		{
    1.68 +		EDKEmptyPswd = 0x10, EDKOddPswdByteCount, EDKBadNullTerminator
    1.69 +		};
    1.70 +	static void Panic(TPanic aPanic);
    1.71 +#endif
    1.72 +
    1.73 +	// not implemented - prevents instantiation
    1.74 +	PKCS12KDF();
    1.75 +	};
    1.76 +
    1.77 +#endif	// #ifndef __PKCS12KDF_H__
    1.78 +