All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::Crypto::DigestAlgorithm Class Reference

#include <DigestAlgorithm.h>

Public Types

enum  Type {
  e_SHA1 = 0, e_SHA256 = 1, e_SHA384 = 2, e_SHA512 = 3,
  e_RIPEMD160 = 4, e_unknown_digest_algorithm = 5
}
 

Static Public Member Functions

static std::vector< UCharCalculateDigest (DigestAlgorithm::Type in_digest_algorithm_type, const std::vector< UChar > &in_message_buf)
 
static std::vector< UCharSignDigest (const std::vector< UChar > &digest_buf, const DigestAlgorithm::Type digest_algorithm_type, const UString pkcs12_keyfile_path, const UString pkcs12_password)
 
static std::vector< UCharSignDigest (const std::vector< UChar > &digest_buf, const DigestAlgorithm::Type digest_algorithm_type, const std::vector< UChar > &pkcs12_buf, const UString pkcs12_password)
 
static std::vector< UCharCalculateDigest (DigestAlgorithm::Type in_digest_algorithm_type, const UChar *in_message_buf, const size_t in_message_buf_size)
 
static std::vector< UCharSignDigest (const UChar *digest_buf, const size_t digest_buf_size, const DigestAlgorithm::Type digest_algorithm_type, const UString pkcs12_keyfile_path, const UString pkcs12_password)
 
static std::vector< UCharSignDigest (const UChar *digest_buf, const size_t digest_buf_size, const DigestAlgorithm::Type digest_algorithm_type, const UChar *pkcs12_buf, const size_t pkcs12_buf_size, const UString pkcs12_password)
 

Detailed Description

Definition at line 17 of file DigestAlgorithm.h.

Member Enumeration Documentation

Enumerator
e_SHA1 
e_SHA256 
e_SHA384 
e_SHA512 
e_RIPEMD160 
e_unknown_digest_algorithm 

Definition at line 21 of file DigestAlgorithm.h.

Member Function Documentation

static std::vector<UChar> pdftron::Crypto::DigestAlgorithm::CalculateDigest ( DigestAlgorithm::Type  in_digest_algorithm_type,
const std::vector< UChar > &  in_message_buf 
)
static

Calculates a digest of arbitrary data. Useful during CMS generation custom signing workflows for digesting signedAttributes before sending off for CMS signatureValue generation (e.g. by HSM device or cloud signing platform).

Parameters
in_digest_algorithm_type– the digest algorithm to use
in_message_buf– the message to digest
Returns
a container of bytes corresponding to the digest of the message
static std::vector<UChar> pdftron::Crypto::DigestAlgorithm::CalculateDigest ( DigestAlgorithm::Type  in_digest_algorithm_type,
const UChar in_message_buf,
const size_t  in_message_buf_size 
)
static

Calculates a digest of arbitrary data. Useful during CMS generation custom signing workflows for digesting signedAttributes before sending off for CMS signatureValue generation (e.g. by HSM device or cloud signing platform).

Parameters
in_digest_algorithm_type– the digest algorithm to use
in_message_buf– the message to digest
in_message_buf_size– the size of in_message_buf
Returns
a container of bytes corresponding to the digest of the message
static std::vector<UChar> pdftron::Crypto::DigestAlgorithm::SignDigest ( const std::vector< UChar > &  digest_buf,
const DigestAlgorithm::Type  digest_algorithm_type,
const UString  pkcs12_keyfile_path,
const UString  pkcs12_password 
)
static

Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature.

Parameters
digest_buf– The digest to sign.
digest_algorithm_type– The digest algorithm used to generate the digest.
pkcs12_keyfile_path– The path to the PKCS #12 keyfile (usually has a .pfx extension) to use for signing.
pkcs12_password– The password to use to parse the PKCS #12 keyfile.
Returns
the DER-serialized bytes of the signature.
static std::vector<UChar> pdftron::Crypto::DigestAlgorithm::SignDigest ( const std::vector< UChar > &  digest_buf,
const DigestAlgorithm::Type  digest_algorithm_type,
const std::vector< UChar > &  pkcs12_buf,
const UString  pkcs12_password 
)
static

Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature.

Parameters
digest_buf– The digest to sign.
digest_algorithm_type– The digest algorithm used to generate the digest.
pkcs12_buf– The buffer containing the PKCS #12 key (as usually stored in .pfx files) to use for signing.
pkcs12_password– The password to use to parse the PKCS 12 key.
Returns
the DER-serialized bytes of the signature.
static std::vector<UChar> pdftron::Crypto::DigestAlgorithm::SignDigest ( const UChar digest_buf,
const size_t  digest_buf_size,
const DigestAlgorithm::Type  digest_algorithm_type,
const UString  pkcs12_keyfile_path,
const UString  pkcs12_password 
)
static

Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature.

Parameters
digest_buf– The digest to sign.
digest_buf_size– The size of the digest.
digest_algorithm_type– The digest algorithm used to generate the digest.
pkcs12_keyfile_path– The path to the PKCS #12 keyfile (usually has a .pfx extension) to use for signing.
pkcs12_password– The password to use to parse the PKCS #12 keyfile.
Returns
the DER-serialized bytes of the signature.
static std::vector<UChar> pdftron::Crypto::DigestAlgorithm::SignDigest ( const UChar digest_buf,
const size_t  digest_buf_size,
const DigestAlgorithm::Type  digest_algorithm_type,
const UChar pkcs12_buf,
const size_t  pkcs12_buf_size,
const UString  pkcs12_password 
)
static

Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx). This function is part of the low-level custom signing API, and works with GenerateESSSigningCertPAdESAttribute, GenerateCMSSignedAttributes, and GenerateCMSSignature.

Parameters
digest_buf– The digest to sign.
digest_buf_size– The size of the digest.
digest_algorithm_type– The digest algorithm used to generate the digest.
pkcs12_buf– The buffer containing the PKCS #12 key (as usually stored in .pfx files) to use for signing.
pkcs12_buf_size– The size of the buffer containing the PKCS #12 key.
pkcs12_password– The password to use to parse the PKCS 12 key.
Returns
the DER-serialized bytes of the signature.

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