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