SignDoc SDK (C)
5.0.0
|
Interface for creating a PKCS #7 or CAdES signature. More...
#include <SignDocSDK-c.h>
Public Types | |
typedef SIGNDOC_Boolean(* | SIGNDOC_SignPKCS7_sign) (void *aClosure, struct SIGNDOC_Source *aSource, SIGNDOC_Boolean aDetached, const char *aHashAlgorithm, struct SIGNDOC_TimeStamper *aTimeStamper, struct SIGNDOC_ByteArray *aOutput) |
Callback: Sign data, producing a PKCS #7 or CAdES signature. More... | |
typedef size_t(* | SIGNDOC_SignPKCS7_getSignatureSize) (void *aClosure, SIGNDOC_Boolean aDetached, const char *aHashAlgorithm) |
Callback: Compute the size of the signature produced by SIGNDOC_SignPKCS7_sign(). More... | |
typedef SIGNDOC_Boolean(* | SIGNDOC_SignPKCS7_getSubjectCommonName) (void *aClosure, char **aOutput) |
Callback: Get the common name (CN) of the certificate's subject. More... | |
typedef const char *(* | SIGNDOC_SignPKCS7_getErrorMessage) (void *aClosure) |
Callback: Get an error message for the last operation. More... | |
Public Member Functions | |
struct SIGNDOC_SignPKCS7 * | SIGNDOC_SignPKCS7_new (struct SIGNDOC_Exception **aEx, void *aClosure, SIGNDOC_SignPKCS7_sign aSign, SIGNDOC_SignPKCS7_getSignatureSize aGetSignatureSize, SIGNDOC_SignPKCS7_getSubjectCommonName aGetSubjectCommonName, SIGNDOC_SignPKCS7_getErrorMessage aGetErrorMessage) |
SIGNDOC_SignPKCS7 constructor. More... | |
void | SIGNDOC_SignPKCS7_delete (struct SIGNDOC_SignPKCS7 *aObj) |
SIGNDOC_SignPKCS7 destructor. More... | |
Interface for creating a PKCS #7 or CAdES signature.
Selection of the certificate, including intermediate certifcatse, and implementing CAdES is up to the implementation.
This interface is quite hard to use, please use SIGNDOC_SignRSA and SIGNDOC_SignECDSA instead.
typedef const char*( * SIGNDOC_SignPKCS7_getErrorMessage) (void *aClosure) |
Callback: Get an error message for the last operation.
After any function pointer of the SIGNDOC_SignPKCS7 object has been called, this function shall return an error message (possibly empty if the most recently called function pointer didn't fail).
[in] | aClosure | A pointer to user-defined object. |
typedef size_t( * SIGNDOC_SignPKCS7_getSignatureSize) (void *aClosure, SIGNDOC_Boolean aDetached, const char *aHashAlgorithm) |
Callback: Compute the size of the signature produced by SIGNDOC_SignPKCS7_sign().
[in] | aClosure | A pointer to user-defined object. |
[in] | aDetached | SIGNDOC_TRUE for a detached signature, SIGNDOC_FALSE for an encapsulated signature. |
[in] | aHashAlgorithm | Hash 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:
|
typedef SIGNDOC_Boolean( * SIGNDOC_SignPKCS7_getSubjectCommonName) (void *aClosure, char **aOutput) |
Callback: Get the common name (CN) of the certificate's subject.
[in] | aClosure | A pointer to user-defined object. |
[out] | aOutput | A pointer to the common name shall be stored here (UTF-8). The string must be allocated with SIGNDOC_alloc() or SIGNDOC_strdup() as the caller will free it with SIGNDOC_free(). |
typedef SIGNDOC_Boolean( * SIGNDOC_SignPKCS7_sign) (void *aClosure, struct SIGNDOC_Source *aSource, SIGNDOC_Boolean aDetached, const char *aHashAlgorithm, struct SIGNDOC_TimeStamper *aTimeStamper, struct SIGNDOC_ByteArray *aOutput) |
Callback: Sign data, producing a PKCS #7 or CAdES signature.
[in] | aClosure | A pointer to user-defined object. |
[in] | aSource | An object providing data to be hashed and signed. If aDetached is SIGNDOC_FALSE, all the data shall be encapsulated in the PKCS #7 message. |
[in] | aDetached | SIGNDOC_TRUE for a detached signature, SIGNDOC_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. The following values are defined:
|
[in] | aTimeStamper | Non-NULL to use a time-stamp server. |
[in,out] | aOutput | The ASN.1-encoded PKCS #7 or CAdES signature shall be stored here. |
void SIGNDOC_SignPKCS7_delete | ( | struct SIGNDOC_SignPKCS7 * | aObj | ) |
SIGNDOC_SignPKCS7 destructor.
[in] | aObj | A pointer to the SIGNDOC_SignPKCS7 object. |
struct SIGNDOC_SignPKCS7 * SIGNDOC_SignPKCS7_new | ( | struct SIGNDOC_Exception ** | aEx, |
void * | aClosure, | ||
SIGNDOC_SignPKCS7_sign | aSign, | ||
SIGNDOC_SignPKCS7_getSignatureSize | aGetSignatureSize, | ||
SIGNDOC_SignPKCS7_getSubjectCommonName | aGetSubjectCommonName, | ||
SIGNDOC_SignPKCS7_getErrorMessage | aGetErrorMessage | ||
) |
SIGNDOC_SignPKCS7 constructor.
[out] | aEx | Any exception will be returned in the object pointed to by this parameter. |
[in] | aClosure | A pointer to user-defined object that will be passed to the callbacks. |
[in] | aSign | Pointer to function implementing sign(). |
[in] | aGetSignatureSize | Pointer to function implementing getSignatureSize(). |
[in] | aGetSubjectCommonName | Pointer to function implementing getSubjectCommonName(). |
[in] | aGetErrorMessage | Pointer to function implementing getErrorMessage(). |