SignDoc SDK (C++)  5.0.0
SignRSA Class Referenceabstract

Interface for creating an RSA signature. More...

#include <SignDocSDK-cpp.h>

Public Member Functions

 SignRSA ()
 Constructor. More...
 
virtual ~SignRSA ()
 Destructor. More...
 
virtual bool sign (Source &aSource, const char *aSignatureScheme, const char *aHashAlgorithm, int aSaltLength, std::vector< unsigned char > &aOutput)=0
 Compute an RSA signature. More...
 
virtual int getSignatureSize ()=0
 Get the size of the signature that will be computed by sign(). More...
 
virtual bool getSigningCertificate (std::vector< unsigned char > &aOutput) const =0
 Get the signing certificate. More...
 
virtual int getCertificateCount () const =0
 Get the number of available intermediate certificates. More...
 
virtual bool getCertificate (int aIndex, std::vector< unsigned char > &aOutput) const =0
 Get an intermediate certificate. More...
 
virtual const char * getErrorMessage () const =0
 Get an error message for the last operation. More...
 
SIGNDOC_SignRSA * getImpl ()
 Internal. More...
 

Detailed Description

Interface for creating an RSA signature.

Selection of the certificate is up to the implementation.

Constructor & Destructor Documentation

SignRSA ( )
inline

Constructor.

virtual ~SignRSA ( )
inlinevirtual

Destructor.

Should release the crypto provider context if one was acquired.

Member Function Documentation

virtual bool getCertificate ( int  aIndex,
std::vector< unsigned char > &  aOutput 
) const
pure virtual

Get an intermediate certificate.

This function must not throw any exception except for std::bad_alloc.

Parameters
[in]aIndexThe zero-based index of the intermediate certificate, see getCertificateCount().
[out]aOutputThe requested intermediate certificate will be stored here (DER-encoded X.509).
Returns
true iff successful.
virtual int getCertificateCount ( ) const
pure virtual

Get the number of available intermediate certificates.

Returns
The number of available intermediate certificates.
virtual const char* getErrorMessage ( ) const
pure virtual

Get an error message for the last operation.

This function must not throw any exception except for std::bad_alloc.

After any member function of this object has been called, you can retrieve an error message by calling this function.

Returns
A pointer to the error message. The pointer will become invalid as soon as any member function of this object is called or this object is destroyed.
SIGNDOC_SignRSA* getImpl ( )
inline

Internal.

virtual int getSignatureSize ( )
pure virtual

Get the size of the signature that will be computed by sign().

Returns
The size in octets of the signature that will be computed by sign() (ie, the size of the private key in octets) or a negative value on error.
virtual bool getSigningCertificate ( std::vector< unsigned char > &  aOutput) const
pure virtual

Get the signing certificate.

This function must not throw any exception except for std::bad_alloc.

Parameters
[out]aOutputThe signing certificate will be stored here (DER-encoded X.509).
Returns
true iff successful.
virtual bool sign ( Source aSource,
const char *  aSignatureScheme,
const char *  aHashAlgorithm,
int  aSaltLength,
std::vector< unsigned char > &  aOutput 
)
pure virtual

Compute an RSA signature.

This function must not throw any exception except for std::bad_alloc.

Parameters
[in]aSourceAn object providing data to be hashed and signed.
[in]aSignatureSchemeThe RSA signature scheme:
  • "PKCS1": PKCS #1 1.5.
  • "PSS": RSASSA-PSS (RSA 2.0), see also aHashAlgorithm and aSaltLength
[in]aHashAlgorithmThe Hash algorithm to be used for the signature and (for RSASSA-PSS) for mask generation:
  • "SHA-1"
  • "SHA-256"
  • "SHA-384"
  • "SHA-512"
  • "RIPEMD-160"
[in]aSaltLengthThe salt length (in octets) for RSASSA-PSS. to be ignored for the PKCS #1 signature scheme.
[out]aOutputThe RSA signature will be stored here. This shall be just the result of the RSA operation, not wrapped in an OCTET STRING.
Returns
true iff successful.

The documentation for this class was generated from the following file: