1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcryptospi/inc/spi/signerplugin.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,116 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Signer Abstract interface
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +/**
1.24 + @file
1.25 + @publishedPartner
1.26 + @released
1.27 +*/
1.28 +
1.29 +#ifndef __CRYPTOAPI_SIGNER_H__
1.30 +#define __CRYPTOAPI_SIGNER_H__
1.31 +
1.32 +#include <cryptospi/cryptoplugin.h>
1.33 +#include <cryptospi/keys.h>
1.34 +
1.35 +namespace CryptoSpi
1.36 + {
1.37 + /**
1.38 + The Signer definition. Intended to allow plug-ins to implement
1.39 + extensible signature signer functionality, and to work with all
1.40 + known existing signature algorithms, e.g. DSA, RSA etc
1.41 + */
1.42 + class MSignatureBase : public MPlugin
1.43 + {
1.44 + public:
1.45 + /**
1.46 + Set the padding mode for the signer or verifier. Reset() is called to reinitialise the cipher.
1.47 + @param aPaddingMode The padding mode of the signer
1.48 + @leave KErrNotSupported if the padding mode is not supported.
1.49 + @leave ... Any of the crypto error codes defined in
1.50 + cryptospi_errs.h or any of the system-wide error codes.
1.51 + */
1.52 + virtual void SetPaddingModeL(TUid aPaddingMode) = 0;
1.53 +
1.54 + /**
1.55 + Set the private key for the signer or verifier. Reset() is called to reinitialise the cipher.
1.56 + @param aPrivateKey The privatekey that used to sign
1.57 + @leave KErrArgument if key is not of the expected type.
1.58 + @leave KErrNotSupported if the key is not of valid length.
1.59 + @leave ... Any of the crypto error codes defined in
1.60 + cryptospi_errs.h or any of the system-wide error codes.
1.61 + */
1.62 + virtual void SetKeyL(const CKey& aPrivateKey) = 0;
1.63 +
1.64 + /**
1.65 + Gets the maximum size of input accepted by this object.
1.66 + @return The maximum length allowed in bytes
1.67 + @leave ... Any of the crypto error codes defined in
1.68 + cryptospi_errs.h or any of the system-wide error codes.
1.69 + */
1.70 + virtual TInt GetMaximumInputLengthL() const = 0;
1.71 +
1.72 + /**
1.73 + Gets the maximum size of output that can be generated by this object.
1.74 + @return The maximum output length in bytes
1.75 + @leave ... Any of the crypto error codes defined in
1.76 + cryptospi_errs.h or any of the system-wide error codes.
1.77 + */
1.78 + virtual TInt GetMaximumOutputLengthL() const = 0;
1.79 + };
1.80 +
1.81 + class MSigner : public MSignatureBase
1.82 + {
1.83 + public:
1.84 +
1.85 + /**
1.86 + Signs the input hash
1.87 + @param aInput The hash of the message to sign
1.88 + @param aSignature The signature of the hash
1.89 + @leave ... Any of the crypto error codes defined in
1.90 + cryptospi_errs.h or any of the system-wide error codes.
1.91 + */
1.92 + virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature) = 0;
1.93 + };
1.94 +
1.95 +
1.96 + class MAsyncSigner : public MSignatureBase
1.97 + {
1.98 + public:
1.99 +
1.100 + /**
1.101 + Set the public key for the signer
1.102 + @param aInput The hash of the message to sign
1.103 + @param aSignature The signature of the hash
1.104 + @param aRequestStatus
1.105 + @leave ... Any of the crypto error codes defined in
1.106 + cryptospi_errs.h or any of the system-wide error codes.
1.107 + */
1.108 + virtual void SignL(const TDesC8& aInput, CCryptoParams& aSignature, TRequestStatus& aRequestStatus) = 0;
1.109 +
1.110 + /**
1.111 + Cancel the outstanding request
1.112 + */
1.113 + virtual void Cancel() = 0;
1.114 +
1.115 + };
1.116 +
1.117 + } // namespace CryptoSpi
1.118 +
1.119 +#endif //__CRYPTOAPI_SIGNER_H__