sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* ** IMPORTANT ** PublishedPartner API's in this file are published to 3rd party developers via the
|
sl@0
|
16 |
* Symbian website. Changes to these API's should be treated as PublishedAll API changes and the Security TA should be consulted.
|
sl@0
|
17 |
*
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@file
|
sl@0
|
23 |
@publishedPartner
|
sl@0
|
24 |
@released
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
|
sl@0
|
27 |
#ifndef __CRYPTOSTRENGTH_H__
|
sl@0
|
28 |
#define __CRYPTOSTRENGTH_H__
|
sl@0
|
29 |
|
sl@0
|
30 |
/**
|
sl@0
|
31 |
* Some builds of the crypto library have restrictions that only allow weak
|
sl@0
|
32 |
* ciphers to be used. This class provides static helper functions for
|
sl@0
|
33 |
* determining these restrictions.
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
class TCrypto
|
sl@0
|
36 |
{
|
sl@0
|
37 |
public:
|
sl@0
|
38 |
/**
|
sl@0
|
39 |
* Defines the strength of the cipher.
|
sl@0
|
40 |
*/
|
sl@0
|
41 |
enum TStrength
|
sl@0
|
42 |
{
|
sl@0
|
43 |
EWeak, EStrong
|
sl@0
|
44 |
};
|
sl@0
|
45 |
public:
|
sl@0
|
46 |
/**
|
sl@0
|
47 |
* Gets the allowed cipher strength.
|
sl@0
|
48 |
*
|
sl@0
|
49 |
* @return The allowed cipher strength.
|
sl@0
|
50 |
*/
|
sl@0
|
51 |
static IMPORT_C TCrypto::TStrength Strength();
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
* Indicates whether a symmetric key is small enough to be allowed. Note
|
sl@0
|
55 |
* that this function leaves if the key is too large - in other words it can
|
sl@0
|
56 |
* never return EFalse.
|
sl@0
|
57 |
*
|
sl@0
|
58 |
* @param aSymmetricKeyBits The size (in bits) of the symmetric key
|
sl@0
|
59 |
* @return Whether the key is small enough to be allowed
|
sl@0
|
60 |
*
|
sl@0
|
61 |
* @leave KErrKeyNotWeakEnough If the key size is larger than that allowed by the
|
sl@0
|
62 |
* cipher strength restrictions of the crypto library.
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
static IMPORT_C TBool IsSymmetricWeakEnoughL(TInt aSymmetricKeyBits);
|
sl@0
|
65 |
|
sl@0
|
66 |
/**
|
sl@0
|
67 |
* Indicates whether an asymmetric key is small enough to be allowed. Note
|
sl@0
|
68 |
* that this function leaves if the key is too large - in other words it can
|
sl@0
|
69 |
* never return EFalse.
|
sl@0
|
70 |
*
|
sl@0
|
71 |
* @param aAsymmetricKeyBits The size (in bits) of the asymmetric key
|
sl@0
|
72 |
* @return Whether the key is small enough to be allowed
|
sl@0
|
73 |
*
|
sl@0
|
74 |
* @leave KErrKeyNotWeakEnough If the key size is larger than that allowed by the
|
sl@0
|
75 |
* cipher strength restrictions of the crypto library.
|
sl@0
|
76 |
*/
|
sl@0
|
77 |
static IMPORT_C TBool IsAsymmetricWeakEnoughL(TInt aAsymmetricKeyBits);
|
sl@0
|
78 |
};
|
sl@0
|
79 |
|
sl@0
|
80 |
#endif //__CRYPTOSTRENGTH_H__
|