|
1 /* |
|
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include "cryptostrength.h" |
|
21 #include <securityerr.h> |
|
22 |
|
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 |
|
32 |
|
33 EXPORT_C TCrypto::TStrength TCrypto::Strength(void) |
|
34 { |
|
35 return (KCryptoStrength); |
|
36 } |
|
37 |
|
38 EXPORT_C TBool TCrypto::IsSymmetricWeakEnoughL(TInt aSymmetricKeyBits) |
|
39 { |
|
40 if(aSymmetricKeyBits > KDTIMaxSymmetricKeyBits) |
|
41 { |
|
42 User::Leave(KErrKeyNotWeakEnough); |
|
43 } |
|
44 return ETrue; |
|
45 } |
|
46 |
|
47 EXPORT_C TBool TCrypto::IsAsymmetricWeakEnoughL(TInt aAsymmetricKeyBits) |
|
48 { |
|
49 if(aAsymmetricKeyBits > KDTIMaxAsymmetricKeyBits) |
|
50 { |
|
51 User::Leave(KErrKeyNotWeakEnough); |
|
52 } |
|
53 return ETrue; |
|
54 } |
|
55 |