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. |
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.
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.
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).
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.
[in] | aDetached | true for a detached signature, false for an encapsulated signature. |
[in] | aHashAlgorithm | Hash 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. |
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.
[out] | aOutput | The common name shall be stored here (UTF-8). |
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.
[in] | aSource | An object providing data to be signed. If aDetached is false, all the data shall be encapsulated in the PKCS #7 message. |
[in] | aDetached | true for a detached signature, false for an encapsulated signature. |
[in] | aHashAlgorithm | Hash 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] | aTimeStamper | Non-NULL to use a time-stamp server. |
[out] | aOutput | The ASN.1-encoded PKCS #7 or CAdES signature shall be stored here. |