SignDoc SDK (C)  5.0.0
SIGNDOC_SignRSA Class Reference

Interface for creating an RSA signature. More...

#include <SignDocSDK-c.h>

Public Types

typedef SIGNDOC_Boolean(* SIGNDOC_SignRSA_sign) (void *aClosure, struct SIGNDOC_Source *aSource, const char *aSignatureScheme, const char *aHashAlgorithm, int aSaltLength, struct SIGNDOC_ByteArray *aOutput)
 Callback: Compute an RSA signature. More...
 
typedef int(* SIGNDOC_SignRSA_getSignatureSize) (void *aClosure)
 Callback: Get the size of the signature that will be computed by SIGNDOC_SignRSA_sign. More...
 
typedef SIGNDOC_Boolean(* SIGNDOC_SignRSA_getSigningCertificate) (const void *aClosure, struct SIGNDOC_ByteArray *aOutput)
 Callback: Get the signing certificate. More...
 
typedef int(* SIGNDOC_SignRSA_getCertificateCount) (const void *aClosure)
 Callback: Get the number of available intermediate certificates. More...
 
typedef SIGNDOC_Boolean(* SIGNDOC_SignRSA_getCertificate) (const void *aClosure, int aIndex, struct SIGNDOC_ByteArray *aOutput)
 Callback: Get an intermediate certificate. More...
 
typedef const char *(* SIGNDOC_SignRSA_getErrorMessage) (const void *aClosure)
 Callback: Get an error message for the last operation. More...
 

Public Member Functions

struct SIGNDOC_SignRSASIGNDOC_SignRSA_new (struct SIGNDOC_Exception **aEx, void *aClosure, SIGNDOC_SignRSA_sign aSign, SIGNDOC_SignRSA_getSignatureSize aGetSignatureSize, SIGNDOC_SignRSA_getSigningCertificate aGetSigningCertificate, SIGNDOC_SignRSA_getCertificateCount aGetCertificateCount, SIGNDOC_SignRSA_getCertificate aGetCertificate, SIGNDOC_SignRSA_getErrorMessage aGetErrorMessage)
 SIGNDOC_SignRSA constructor. More...
 
void SIGNDOC_SignRSA_delete (struct SIGNDOC_SignRSA *aObj)
 SIGNDOC_SignRSA destructor. More...
 

Detailed Description

Interface for creating an RSA signature.

Selection of the certificate is up to the implementation.

Member Typedef Documentation

typedef SIGNDOC_Boolean( * SIGNDOC_SignRSA_getCertificate) (const void *aClosure, int aIndex, struct SIGNDOC_ByteArray *aOutput)

Callback: Get an intermediate certificate.

Parameters
[in]aClosureA pointer to user-defined object.
[in]aIndexThe zero-based index of the intermediate certificate, see SIGNDOC_SignRSA_getCertificateCount().
[in,out]aOutputThe requested intermediate certificate shall be stored here (DER-encoded X.509).
Returns
SIGNDOC_TRUE if successful, SIGNDOC_FALSE on error.
typedef int( * SIGNDOC_SignRSA_getCertificateCount) (const void *aClosure)

Callback: Get the number of available intermediate certificates.

Parameters
[in]aClosureA pointer to user-defined object.
Returns
The number of available intermediate certificates.
typedef const char*( * SIGNDOC_SignRSA_getErrorMessage) (const void *aClosure)

Callback: Get an error message for the last operation.

After any function pointer of the SIGNDOC_SignRSA object has been called, this function shall return an error message (possibly empty if the most recently called function pointer didn't fail).

Parameters
[in]aClosureA pointer to user-defined object.
Returns
A pointer to the error message. The caller assumes that the pointer may bcome invalid as soon as any function pointer of the SIGNDOC_SignRSA object is called or that object is destroyed.
typedef int( * SIGNDOC_SignRSA_getSignatureSize) (void *aClosure)

Callback: Get the size of the signature that will be computed by SIGNDOC_SignRSA_sign.

Parameters
[in]aClosureA pointer to user-defined object.
Returns
The size in octets of the signature that will be computed by SIGNDOC_SignRSA_sign (ie, the size of the private key in octets) or a negative value on error.
typedef SIGNDOC_Boolean( * SIGNDOC_SignRSA_getSigningCertificate) (const void *aClosure, struct SIGNDOC_ByteArray *aOutput)

Callback: Get the signing certificate.

Parameters
[in]aClosureA pointer to user-defined object.
[in,out]aOutputThe signing certificate shall be stored here (DER-encoded X.509).
Returns
SIGNDOC_TRUE if successful, SIGNDOC_FALSE on error.
typedef SIGNDOC_Boolean( * SIGNDOC_SignRSA_sign) (void *aClosure, struct SIGNDOC_Source *aSource, const char *aSignatureScheme, const char *aHashAlgorithm, int aSaltLength, struct SIGNDOC_ByteArray *aOutput)

Callback: Compute an RSA signature.

Parameters
[in]aClosureA pointer to user-defined object.
[in]aSourceAn object providing data to be hashed and signed.
[in]aSignatureSchemeThe RSA signature scheme:
  • "PKCS1": PKCS #1 1.5.
  • "PSS": RSASSA-PSS (RSA 2.0), see also aHashAlgorithm and aSaltLength
[in]aHashAlgorithmThe Hash algorithm to be used for the signature and (for RSASSA-PSS) for mask generation:
  • "SHA-1"
  • "SHA-256"
  • "SHA-384"
  • "SHA-512"
  • "RIPEMD-160"
[in]aSaltLengthThe salt length (in octets) for RSASSA-PSS, to be ignored for teh PKCS #1 padding scheme.
[in,out]aOutputThe RSA signature shall be stored here. This shall be just the result of the RSA operation, not wrapped in an OCTET STRING.
Returns
SIGNDOC_TRUE if successful, SIGNDOC_FALSE on error.

Member Function Documentation

void SIGNDOC_SignRSA_delete ( struct SIGNDOC_SignRSA aObj)

SIGNDOC_SignRSA destructor.

Parameters
[in]aObjA pointer to the SIGNDOC_SignRSA object.
struct SIGNDOC_SignRSA * SIGNDOC_SignRSA_new ( struct SIGNDOC_Exception **  aEx,
void *  aClosure,
SIGNDOC_SignRSA_sign  aSign,
SIGNDOC_SignRSA_getSignatureSize  aGetSignatureSize,
SIGNDOC_SignRSA_getSigningCertificate  aGetSigningCertificate,
SIGNDOC_SignRSA_getCertificateCount  aGetCertificateCount,
SIGNDOC_SignRSA_getCertificate  aGetCertificate,
SIGNDOC_SignRSA_getErrorMessage  aGetErrorMessage 
)

SIGNDOC_SignRSA constructor.

Parameters
[out]aExAny exception will be returned in the object pointed to by this parameter.
[in]aClosureA pointer to user-defined object that will be passed to the callbacks.
[in]aSignPointer to function implementing sign().
[in]aGetSignatureSizePointer to function implementing getSignatureSize().
[in]aGetSigningCertificatePointer to function implementing getSigningCertificate().
[in]aGetCertificateCountPointer to function implementing getCertificateCount().
[in]aGetCertificatePointer to function implementing getCertificate().
[in]aGetErrorMessagePointer to function implementing getErrorMessage().
Returns
A pointer to a new SIGNDOC_SignRSA object.
See also
SIGNDOC_SignRSA_delete()

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