From 7341cd0159d49464f7f3639c998c4b66d6bf9e49 Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Wed, 29 Nov 2023 13:54:56 -0800 Subject: [PATCH] pss: expose a `get_default_pss_signature_algo_id` helper (#393) This returns the `AlgorithmIdentifierOwned` assuming the default situation where the salt_len is the `output_size` of the `Digest`. This is meant to be used by HSM where the private key is hidden behind an abstraction but to still expose a `DynSignatureAlgorithmIdentifier` trait. --- src/pss.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pss.rs b/src/pss.rs index dd6ebcc..e0b9413 100644 --- a/src/pss.rs +++ b/src/pss.rs @@ -227,6 +227,15 @@ fn sign_pss_with_salt_digest() -> pkcs8::spki::Result +where + D: Digest + AssociatedOid, +{ + let salt_len: u8 = ::output_size() as u8; + get_pss_signature_algo_id::(salt_len) +} + fn get_pss_signature_algo_id(salt_len: u8) -> pkcs8::spki::Result where D: Digest + AssociatedOid,