Public Types | Public Member Functions

de::softpro::doc::SignPKCS7 Class Reference

Interface for creating a PKCS #7 or CAdES signature. More...

#include <SignDocSDK-cpp.h>

Public Types

enum  HashAlgorithm {
  ha_none, ha_sha1, ha_sha256, ha_md5,
  ha_sha384, ha_sha512, ha_ripemd160, ha_sha224
}
 

Hash Algorithm to be used for signature.

More...

Public Member Functions

 SignPKCS7 ()
 Constructor.
virtual ~SignPKCS7 ()
 Destructor.
virtual bool sign (Source &aSource, bool aDetached, HashAlgorithm aHashAlgorithm, TimeStamper *aTimeStamper, std::vector< unsigned char > &aOutput)=0
 Sign data, producing a PKCS #7 or CAdES signature.
virtual size_t getSignatureSize (bool aDetached, HashAlgorithm aHashAlgorithm)=0
 Compute the size of the signature produced by sign().
virtual bool getSubjectCommonName (std::string &aOutput) const =0
 Get the common name (CN) of the certificate's subject.
virtual const char * getErrorMessage () const =0
 Get an error message for the last operation.
SIGNDOC_SignPKCS7 * getImpl ()
 Internal.

Detailed Description

Interface for creating a PKCS #7 or CAdES signature.

Selection of the certificate and implementing CAdES is up to the implementation.

This interface is quite hard to use, please use SignRSA instead.


Member Enumeration Documentation

Hash Algorithm to be used for signature.

Enumerator:
ha_none 

Invalid hash algorithm.

ha_sha1 

SHA-1.

ha_sha256 

SHA-256.

ha_md5 

MD5.

ha_sha384 

SHA-384.

ha_sha512 

SHA-512.

ha_ripemd160 

RIPEMD-160.

ha_sha224 

SHA-224.


Constructor & Destructor Documentation

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

Constructor.

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

Destructor.

Windows: The destructor Should release the crypto provider context if one was acquired.


Member Function Documentation

virtual const char* de::softpro::doc::SignPKCS7::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, this function shall return an error message (possibly empty if the most recently called member function didn't fail).

Returns:
A pointer to the error message. The caller assumes that the pointer may become invalid as soon as any member function of this object is called or this object is destroyed.
SIGNDOC_SignPKCS7* de::softpro::doc::SignPKCS7::getImpl (  ) [inline]

Internal.

virtual size_t de::softpro::doc::SignPKCS7::getSignatureSize ( bool  aDetached,
HashAlgorithm  aHashAlgorithm 
) [pure virtual]

Compute the size of the signature produced by sign().

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

Parameters:
[in]aDetachedtrue for a detached signature, false for an encapsulated signature.
[in]aHashAlgorithmHash algorithm to be used for the signature. This parameter also determines the size of encapsulated data (20 octets for ha_sha1) if aDetached is false. You might want to ignore this value for ECDSA signatures as it might come from the DigestMethod seed value, which is to be used for RSA only.
Returns:
A positive number which is an upper limit to the number of octets required for the ASN.1-encoded signature (excluding any RFC 3161 timestamp), zero on error.
virtual bool de::softpro::doc::SignPKCS7::getSubjectCommonName ( std::string &  aOutput ) const [pure virtual]

Get the common name (CN) of the certificate's subject.

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

Parameters:
[out]aOutputThe common name shall be stored here (UTF-8).
Returns:
true iff successful.
virtual bool de::softpro::doc::SignPKCS7::sign ( Source aSource,
bool  aDetached,
HashAlgorithm  aHashAlgorithm,
TimeStamper aTimeStamper,
std::vector< unsigned char > &  aOutput 
) [pure virtual]

Sign data, producing a PKCS #7 or CAdES signature.

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

Parameters:
[in]aSourceAn object providing data to be signed. If aDetached is false, all the data shall be encapsulated in the PKCS #7 message.
[in]aDetachedtrue for a detached signature, false for an encapsulated signature.
[in]aHashAlgorithmHash algorithm to be used for the signature. You might want to ignore this value for ECDSA signatures as it might come from the DigestMethod seed value, which is to be used for RSA only.
[in]aTimeStamperNon-NULL to use a time-stamp server.
[out]aOutputThe ASN.1-encoded PKCS #7 or CAdES signature shall be stored here.
Returns:
true iff successful.

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