From fd5598d6c685b9cbf28be421fe848ce496e5cc34 Mon Sep 17 00:00:00 2001 From: ph0llux Date: Mon, 29 Jul 2024 05:06:58 +0200 Subject: [PATCH] signature verification with base64 encoded keys added --- src/lib/signatures.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/signatures.rs b/src/lib/signatures.rs index 3d479c5..7ed6727 100644 --- a/src/lib/signatures.rs +++ b/src/lib/signatures.rs @@ -76,6 +76,12 @@ impl Signature { signature.to_bytes() } + /// verify the data with the given base64 encoded key (signing key or verifying keys are possible to use here). + pub fn verify_with_base64_key>(key: K, message: &[u8], signature: [u8; ED25519_DALEK_SIGNATURE_LEN]) -> Result { + let key = base64engine.decode(key.into())?; + Signature::verify(key, message, signature) + } + /// verify the data with the given key bytes (signing key or verifying keys are possible to use here). pub fn verify(key: K, message: &[u8], signature: [u8; ED25519_DALEK_SIGNATURE_LEN]) -> Result where