prepare_digest_data_for_openpgp

Function prepare_digest_data_for_openpgp 

Source
fn prepare_digest_data_for_openpgp(
    signature_type: SignatureType,
    oid: AlgorithmIdentifier,
    digest: &[u8],
) -> Result<Cow<'_, [u8]>, Error>
Expand description

Transforms the raw digest data for cryptographic signing with OpenPGP.

Raw cryptographic signing primitives have special provisions that need to be taken care of when using certain combinations of signing schemes and hashing algorithms.

This function transforms the digest into bytes that are ready to be passed to raw cryptographic functions. The exact specifics of the transformations are documented inside the function.

ยงErrors

Returns a PKCS#1 encoding error wrapped in Error::Hsm in case the RSA-PKCS#1 signing scheme is used but the encoding of digest to the DigestInfo structure fails.