sl@0: /* sl@0: * Copyright (c) 2003-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: * ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the sl@0: * Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted. 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: #ifndef __CRYPTOSTRENGTH_H__ sl@0: #define __CRYPTOSTRENGTH_H__ sl@0: sl@0: /** sl@0: * Some builds of the crypto library have restrictions that only allow weak sl@0: * ciphers to be used. This class provides static helper functions for sl@0: * determining these restrictions. sl@0: */ sl@0: class TCrypto sl@0: { sl@0: public: sl@0: /** sl@0: * Defines the strength of the cipher. sl@0: */ sl@0: enum TStrength sl@0: { sl@0: EWeak, EStrong sl@0: }; sl@0: public: sl@0: /** sl@0: * Gets the allowed cipher strength. sl@0: * sl@0: * @return The allowed cipher strength. sl@0: */ sl@0: static IMPORT_C TCrypto::TStrength Strength(); sl@0: sl@0: /** sl@0: * Indicates whether a symmetric key is small enough to be allowed. Note sl@0: * that this function leaves if the key is too large - in other words it can sl@0: * never return EFalse. sl@0: * sl@0: * @param aSymmetricKeyBits The size (in bits) of the symmetric key sl@0: * @return Whether the key is small enough to be allowed sl@0: * sl@0: * @leave KErrKeyNotWeakEnough If the key size is larger than that allowed by the sl@0: * cipher strength restrictions of the crypto library. sl@0: */ sl@0: static IMPORT_C TBool IsSymmetricWeakEnoughL(TInt aSymmetricKeyBits); sl@0: sl@0: /** sl@0: * Indicates whether an asymmetric key is small enough to be allowed. Note sl@0: * that this function leaves if the key is too large - in other words it can sl@0: * never return EFalse. sl@0: * sl@0: * @param aAsymmetricKeyBits The size (in bits) of the asymmetric key sl@0: * @return Whether the key is small enough to be allowed sl@0: * sl@0: * @leave KErrKeyNotWeakEnough If the key size is larger than that allowed by the sl@0: * cipher strength restrictions of the crypto library. sl@0: */ sl@0: static IMPORT_C TBool IsAsymmetricWeakEnoughL(TInt aAsymmetricKeyBits); sl@0: }; sl@0: sl@0: #endif //__CRYPTOSTRENGTH_H__