|
1 /* |
|
2 * Copyright (c) 2003-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 * ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the |
|
16 * Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 /** |
|
24 @file |
|
25 @publishedPartner |
|
26 @released |
|
27 */ |
|
28 |
|
29 #ifndef __CRYPTOSTRENGTH_H__ |
|
30 #define __CRYPTOSTRENGTH_H__ |
|
31 |
|
32 /** |
|
33 * Some builds of the crypto library have restrictions that only allow weak |
|
34 * ciphers to be used. This class provides static helper functions for |
|
35 * determining these restrictions. |
|
36 */ |
|
37 class TCrypto |
|
38 { |
|
39 public: |
|
40 /** |
|
41 * Defines the strength of the cipher. |
|
42 */ |
|
43 enum TStrength |
|
44 { |
|
45 EWeak, EStrong |
|
46 }; |
|
47 public: |
|
48 /** |
|
49 * Gets the allowed cipher strength. |
|
50 * |
|
51 * @return The allowed cipher strength. |
|
52 */ |
|
53 static IMPORT_C TCrypto::TStrength Strength(); |
|
54 |
|
55 /** |
|
56 * Indicates whether a symmetric key is small enough to be allowed. Note |
|
57 * that this function leaves if the key is too large - in other words it can |
|
58 * never return EFalse. |
|
59 * |
|
60 * @param aSymmetricKeyBits The size (in bits) of the symmetric key |
|
61 * @return Whether the key is small enough to be allowed |
|
62 * |
|
63 * @leave KErrKeyNotWeakEnough If the key size is larger than that allowed by the |
|
64 * cipher strength restrictions of the crypto library. |
|
65 */ |
|
66 static IMPORT_C TBool IsSymmetricWeakEnoughL(TInt aSymmetricKeyBits); |
|
67 |
|
68 /** |
|
69 * Indicates whether an asymmetric key is small enough to be allowed. Note |
|
70 * that this function leaves if the key is too large - in other words it can |
|
71 * never return EFalse. |
|
72 * |
|
73 * @param aAsymmetricKeyBits The size (in bits) of the asymmetric key |
|
74 * @return Whether the key is small enough to be allowed |
|
75 * |
|
76 * @leave KErrKeyNotWeakEnough If the key size is larger than that allowed by the |
|
77 * cipher strength restrictions of the crypto library. |
|
78 */ |
|
79 static IMPORT_C TBool IsAsymmetricWeakEnoughL(TInt aAsymmetricKeyBits); |
|
80 }; |
|
81 |
|
82 #endif //__CRYPTOSTRENGTH_H__ |