Update contrib.
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #include "cryptostrength.h"
21 #include <securityerr.h>
23 #ifdef CRYPTO_STRONG_BUILD
24 const TInt KDTIMaxSymmetricKeyBits = KMaxTInt;
25 const TInt KDTIMaxAsymmetricKeyBits = KMaxTInt;
26 const TCrypto::TStrength KCryptoStrength=TCrypto::EStrong;
27 #else //CRYPTO_WEAK_BUILD
28 const TInt KDTIMaxSymmetricKeyBits = 56;
29 const TInt KDTIMaxAsymmetricKeyBits = 512;
30 const TCrypto::TStrength KCryptoStrength=TCrypto::EWeak;
31 #endif //CRYPTO_STRONG_BUILD
33 EXPORT_C TCrypto::TStrength TCrypto::Strength(void)
35 return (KCryptoStrength);
38 EXPORT_C TBool TCrypto::IsSymmetricWeakEnoughL(TInt aSymmetricKeyBits)
40 if(aSymmetricKeyBits > KDTIMaxSymmetricKeyBits)
42 User::Leave(KErrKeyNotWeakEnough);
47 EXPORT_C TBool TCrypto::IsAsymmetricWeakEnoughL(TInt aAsymmetricKeyBits)
49 if(aAsymmetricKeyBits > KDTIMaxAsymmetricKeyBits)
51 User::Leave(KErrKeyNotWeakEnough);