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: #include sl@0: #include "cryptostrength.h" sl@0: #include sl@0: sl@0: #ifdef CRYPTO_STRONG_BUILD sl@0: const TInt KDTIMaxSymmetricKeyBits = KMaxTInt; sl@0: const TInt KDTIMaxAsymmetricKeyBits = KMaxTInt; sl@0: const TCrypto::TStrength KCryptoStrength=TCrypto::EStrong; sl@0: #else //CRYPTO_WEAK_BUILD sl@0: const TInt KDTIMaxSymmetricKeyBits = 56; sl@0: const TInt KDTIMaxAsymmetricKeyBits = 512; sl@0: const TCrypto::TStrength KCryptoStrength=TCrypto::EWeak; sl@0: #endif //CRYPTO_STRONG_BUILD sl@0: sl@0: EXPORT_C TCrypto::TStrength TCrypto::Strength(void) sl@0: { sl@0: return (KCryptoStrength); sl@0: } sl@0: sl@0: EXPORT_C TBool TCrypto::IsSymmetricWeakEnoughL(TInt aSymmetricKeyBits) sl@0: { sl@0: if(aSymmetricKeyBits > KDTIMaxSymmetricKeyBits) sl@0: { sl@0: User::Leave(KErrKeyNotWeakEnough); sl@0: } sl@0: return ETrue; sl@0: } sl@0: sl@0: EXPORT_C TBool TCrypto::IsAsymmetricWeakEnoughL(TInt aAsymmetricKeyBits) sl@0: { sl@0: if(aAsymmetricKeyBits > KDTIMaxAsymmetricKeyBits) sl@0: { sl@0: User::Leave(KErrKeyNotWeakEnough); sl@0: } sl@0: return ETrue; sl@0: } sl@0: