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 } |
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.
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, you can retrieve an error message by calling this function.
| 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 signature. This parameter also determines the size of encapsulated data (20 octets for ha_sha1) if aDetached is false. |
| 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 will 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 will be copied into the output. |
| [in] | aDetached | true for a detached signature, false for an encapsulated signature. |
| [in] | aHashAlgorithm | Hash algorithm to be used for signature. Must not be ha_none. |
| [in] | aTimeStamper | Non-NULL to use a time-stamp server. |
| [out] | aOutput | The ASN.1-encoded PKCS #7 or CAdES signature will be stored here. |
1.7.2