17
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-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 |
* DSA shim classes definition
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file
|
|
22 |
@internalComponent
|
|
23 |
@released
|
|
24 |
*/
|
|
25 |
|
|
26 |
#ifndef __DSASHIM_H__
|
|
27 |
#define __DSASHIM_H__
|
|
28 |
|
|
29 |
#include <asymmetric.h>
|
|
30 |
|
|
31 |
namespace CryptoSpi
|
|
32 |
{
|
|
33 |
class CSigner;
|
|
34 |
class CVerifier;
|
|
35 |
class CKey;
|
|
36 |
}
|
|
37 |
|
|
38 |
NONSHARABLE_CLASS(CDsaSignerShim) : public CDSASigner
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
/**
|
|
42 |
Creates an CDsaSignerShim object which has the same interface
|
|
43 |
as CDSASigner but delegates all work to a Crypto SPI plug-in.
|
|
44 |
|
|
45 |
@param aKey The signing key
|
|
46 |
@return A pointer to a CDsaSignerShim instance
|
|
47 |
*/
|
|
48 |
static CDsaSignerShim* NewL(const CDSAPrivateKey& aKey);
|
|
49 |
|
|
50 |
/**
|
|
51 |
Creates an CDsaSignerShim object which has the same interface
|
|
52 |
as CDSASigner but delegates all work to a Crypto SPI plug-in.
|
|
53 |
|
|
54 |
A pointer to the new object is placed on the cleanup stack
|
|
55 |
|
|
56 |
@param aKey The signing key
|
|
57 |
@return A pointer to a CDsaSignerShim instance
|
|
58 |
*/
|
|
59 |
static CDsaSignerShim* NewLC(const CDSAPrivateKey& aKey);
|
|
60 |
|
|
61 |
/**
|
|
62 |
Digitally signs the specified input message
|
|
63 |
Note that in order to be interoperable and compliant with the DSS, aInput
|
|
64 |
must be the result of a SHA-1 hash.
|
|
65 |
|
|
66 |
@param aInput A SHA-1 hash of the message to sign
|
|
67 |
@return A pointer to a new CSignature object
|
|
68 |
@panic ECryptoPanicInputTooLarge If aInput is larger than MaxInputLength(),
|
|
69 |
which is likely to happen if the caller
|
|
70 |
has passed in something that has not been hashed.
|
|
71 |
*/
|
|
72 |
virtual CDSASignature* SignL(const TDesC8& aInput) const;
|
|
73 |
|
|
74 |
//From MSignatureSystem
|
|
75 |
virtual TInt MaxInputLength() const;
|
|
76 |
|
|
77 |
/// Destructor
|
|
78 |
~CDsaSignerShim();
|
|
79 |
|
|
80 |
private:
|
|
81 |
/// Constructor
|
|
82 |
CDsaSignerShim(const CDSAPrivateKey& aKey);
|
|
83 |
void ConstructL(const CDSAPrivateKey& aKey);
|
|
84 |
|
|
85 |
private:
|
|
86 |
/// SPI delegate
|
|
87 |
CryptoSpi::CSigner* iSignerImpl;
|
|
88 |
|
|
89 |
/// SPI requires all key to passed as key-objects
|
|
90 |
CryptoSpi::CKey* iKey;
|
|
91 |
};
|
|
92 |
|
|
93 |
NONSHARABLE_CLASS(CDsaVerifierShim) : public CDSAVerifier
|
|
94 |
{
|
|
95 |
public:
|
|
96 |
/**
|
|
97 |
Creates an CDsaVerifierShim object which has the same interface
|
|
98 |
as CDSAVerifier but delegates all work to a Crypto SPI plug-in.
|
|
99 |
|
|
100 |
@param aKey The verification key
|
|
101 |
@return A pointer to a CDsaVerifierShim instance
|
|
102 |
*/
|
|
103 |
static CDsaVerifierShim* NewL(const CDSAPublicKey& aKey);
|
|
104 |
|
|
105 |
/**
|
|
106 |
Creates an CDsaVerifierShim object which has the same interface
|
|
107 |
as CDSAVerifier but delegates all work to a Crypto SPI plug-in.
|
|
108 |
|
|
109 |
A pointer to the new object is placed on the cleanup stack
|
|
110 |
|
|
111 |
@param aKey The verification key
|
|
112 |
@return A pointer to a CDsaVerifierShim instance
|
|
113 |
*/
|
|
114 |
static CDsaVerifierShim* NewLC(const CDSAPublicKey& aKey);
|
|
115 |
|
|
116 |
//From CVerifier
|
|
117 |
virtual TBool VerifyL(const TDesC8& aInput, const CDSASignature& aSignature) const;
|
|
118 |
|
|
119 |
//From MSignatureSystem
|
|
120 |
virtual TInt MaxInputLength() const;
|
|
121 |
|
|
122 |
// Destructor
|
|
123 |
~CDsaVerifierShim();
|
|
124 |
|
|
125 |
private:
|
|
126 |
// Constructor
|
|
127 |
CDsaVerifierShim(const CDSAPublicKey& aKey);
|
|
128 |
void ConstructL(const CDSAPublicKey& aKey);
|
|
129 |
|
|
130 |
private:
|
|
131 |
/// SPI delegate
|
|
132 |
CryptoSpi::CVerifier* iVerifierImpl;
|
|
133 |
|
|
134 |
/// SPI requires all key to passed as key-objects
|
|
135 |
CryptoSpi::CKey* iKey;
|
|
136 |
};
|
|
137 |
|
|
138 |
#endif // __DSASHIM_H__
|