SignDoc SDK (C++)  5.0.0
SignPKCS7 Class Referenceabstract

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

#include <SignDocSDK-cpp.h>

Public Member Functions

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

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.

Constructor & Destructor Documentation

SignPKCS7 ( )
inline

Constructor.

virtual ~SignPKCS7 ( )
inlinevirtual

Destructor.

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

Member Function Documentation

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, 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* getImpl ( )
inline

Internal.

virtual size_t getSignatureSize ( bool  aDetached,
const char *  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 (e.g., 20 octets for "SHA-1") 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. The following values are defined:
  • "MD5"
  • "RIPEMD-160"
  • "SHA-1"
  • "SHA-224"
  • "SHA-256"
  • "SHA-384"
  • "SHA-512"
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 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 sign ( Source aSource,
bool  aDetached,
const char *  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. The following values are defined:
  • "MD5"
  • "RIPEMD-160"
  • "SHA-1"
  • "SHA-224"
  • "SHA-256"
  • "SHA-384"
  • "SHA-512"
[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: