Public Types | Public Member Functions

de::softpro::doc::SignRSA Class Reference

Interface for creating an RSA signature. More...

#include <SignDocSDK-cpp.h>

Public Types

enum  Version { v_1_5, v_2_0_salt0, v_2_0_salt32, v_2_0 = v_2_0_salt0 }
 

RSA version (padding).

More...
enum  HashAlgorithm {
  ha_sha1 = 1, ha_sha256 = 2, ha_sha384 = 3, ha_sha512 = 4,
  ha_ripemd160 = 5
}
 

Hash algorithm.

More...

Public Member Functions

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

Detailed Description

Interface for creating an RSA signature.

Selection of the certificate is up to the implementation.


Member Enumeration Documentation

Hash algorithm.

Enumerator:
ha_sha1 

SHA-1.

ha_sha256 

SHA-256.

ha_sha384 

SHA-384.

ha_sha512 

SHA-512.

ha_ripemd160 

RIPEMD-160.

RSA version (padding).

Enumerator:
v_1_5 

RSA 1.5 (PKCS1-v1_5).

v_2_0_salt0 

RSA 2.0 (RSASSA-PSS) with salt length 0.

This is used for signing TIFF documents with method m_digsig_pkcs1.

The hash algorithm passed in aHashAlgorithm of sign() shall also be used for mask generation, the salt length shall be 0.

v_2_0_salt32 

RSA 2.0 (RSASSA-PSS) with salt length 32.

This is used for PKCS #7 signatures if integer parameter "RSASignatureScheme" is rss_pss.

The hash algorithm passed in aHashAlgorithm of sign() shall also be used for mask generation, the salt length shall be 32.

v_2_0 

Compatibility.


Constructor & Destructor Documentation

de::softpro::doc::SignRSA::SignRSA (  ) [inline]

Constructor.

virtual de::softpro::doc::SignRSA::~SignRSA (  ) [inline, virtual]

Destructor.

Should release the crypto provider context if one was acquired.


Member Function Documentation

virtual bool de::softpro::doc::SignRSA::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 de::softpro::doc::SignRSA::getCertificateCount (  ) const [pure virtual]

Get the number of available intermediate certificates.

Returns:
The number of available intermediate certificates.
virtual const char* de::softpro::doc::SignRSA::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* de::softpro::doc::SignRSA::getImpl (  ) [inline]

Internal.

virtual int de::softpro::doc::SignRSA::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 de::softpro::doc::SignRSA::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 de::softpro::doc::SignRSA::sign ( Source aSource,
Version  aVersion,
HashAlgorithm  aHashAlgorithm,
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]aVersionRSA version.
[in]aHashAlgorithmHash algorithm.
[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: