public final enum

DigestAlgorithm

extends Enum<E extends Enum<E>>
java.lang.Object
   ↳ java.lang.Enum<E extends java.lang.Enum<E>>
     ↳ com.pdftron.crypto.DigestAlgorithm

Summary

Enum Values
DigestAlgorithm  e_ripemd160   
DigestAlgorithm  e_sha1   
DigestAlgorithm  e_sha256   
DigestAlgorithm  e_sha384   
DigestAlgorithm  e_sha512   
DigestAlgorithm  e_unknown_digest_algorithm   
Fields
public final int value
Public Methods
static byte[] calculateDigest(DigestAlgorithm in_digest_algorithm_type, byte[] in_message_buf)
Calculates a digest of arbitrary data.
static byte[] signDigest(byte[] digest_buf, DigestAlgorithm digest_algorithm_type, byte[] pkcs12_buf, String pkcs12_password)
Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx).
static byte[] signDigest(byte[] digest_buf, DigestAlgorithm digest_algorithm_type, String pkcs12_keyfile_path, String pkcs12_password)
Sign the digest of arbitrary data with private key in the provided PKCS #12 key file (.pfx).
static DigestAlgorithm valueOf(String name)
static DigestAlgorithm valueToEnum(int val)
final static DigestAlgorithm[] values()
[Expand]
Inherited Methods
From class java.lang.Enum
From class java.lang.Object
From interface java.lang.Comparable

Enum Values

public static final DigestAlgorithm e_ripemd160

public static final DigestAlgorithm e_sha1

public static final DigestAlgorithm e_sha256

public static final DigestAlgorithm e_sha384

public static final DigestAlgorithm e_sha512

public static final DigestAlgorithm e_unknown_digest_algorithm

Fields

public final int value

Public Methods

public static byte[] calculateDigest (DigestAlgorithm in_digest_algorithm_type, byte[] in_message_buf)

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

public static byte[] signDigest (byte[] digest_buf, DigestAlgorithm digest_algorithm_type, byte[] pkcs12_buf, String pkcs12_password)

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

public static byte[] signDigest (byte[] digest_buf, DigestAlgorithm digest_algorithm_type, String pkcs12_keyfile_path, String pkcs12_password)

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

public static DigestAlgorithm valueOf (String name)

public static DigestAlgorithm valueToEnum (int val)

public static final DigestAlgorithm[] values ()