os/security/crypto/weakcrypto/inc/cryptostrength.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/crypto/weakcrypto/inc/cryptostrength.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,80 @@
     1.4 +/*
     1.5 +* Copyright (c) 2003-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 +* ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the 
    1.19 +* Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted.
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +/**
    1.25 + @file
    1.26 + @publishedPartner
    1.27 + @released
    1.28 +*/
    1.29 +
    1.30 +#ifndef __CRYPTOSTRENGTH_H__
    1.31 +#define __CRYPTOSTRENGTH_H__
    1.32 +
    1.33 +/**
    1.34 + * Some builds of the crypto library have restrictions that only allow weak
    1.35 + * ciphers to be used.  This class provides static helper functions for
    1.36 + * determining these restrictions.
    1.37 + */
    1.38 +class TCrypto
    1.39 +	{
    1.40 +public:
    1.41 +	/**
    1.42 +	 * Defines the strength of the cipher. 
    1.43 +	 */
    1.44 +	enum TStrength 
    1.45 +		{ 
    1.46 +		EWeak, EStrong
    1.47 +		};
    1.48 +public:
    1.49 +	/**
    1.50 +	 * Gets the allowed cipher strength.
    1.51 +	 *
    1.52 +	 * @return The allowed cipher strength.	
    1.53 +	 */	
    1.54 +	static IMPORT_C TCrypto::TStrength Strength();
    1.55 +
    1.56 +	/**
    1.57 +	 * Indicates whether a symmetric key is small enough to be allowed. Note
    1.58 +	 * that this function leaves if the key is too large - in other words it can
    1.59 +	 * never return EFalse.
    1.60 +	 * 
    1.61 +	 * @param aSymmetricKeyBits	    The size (in bits) of the symmetric key
    1.62 +	 * @return						Whether the key is small enough to be allowed
    1.63 +	 * 
    1.64 +	 * @leave KErrKeyNotWeakEnough	If the key size is larger than that allowed by the
    1.65 +	 *								cipher strength restrictions of the crypto library.
    1.66 +	 */
    1.67 +	static IMPORT_C TBool IsSymmetricWeakEnoughL(TInt aSymmetricKeyBits);
    1.68 +
    1.69 +	/**
    1.70 +	 * Indicates whether an asymmetric key is small enough to be allowed.  Note
    1.71 +	 * that this function leaves if the key is too large - in other words it can
    1.72 +	 * never return EFalse.
    1.73 +	 *
    1.74 +	 * @param aAsymmetricKeyBits	The size (in bits) of the asymmetric key
    1.75 +	 * @return						Whether the key is small enough to be allowed
    1.76 +	 * 
    1.77 +	 * @leave KErrKeyNotWeakEnough	If the key size is larger than that allowed by the
    1.78 +	 *								cipher strength restrictions of the crypto library.
    1.79 +	 */
    1.80 +	static IMPORT_C TBool IsAsymmetricWeakEnoughL(TInt aAsymmetricKeyBits);
    1.81 +	};
    1.82 +
    1.83 +#endif //__CRYPTOSTRENGTH_H__