Crate xcbc_rsa_fdh

Source
Expand description

RSA-FDH is a is provably secure blind-signing signature scheme that uses RSA and a full domain hash.

This crate implements two RSA-FDH signature schemes:

  1. A regular signature scheme with Full Domain Hash (FDH) padding.

  2. A blind signature scheme that that supports blind-signing to keep the message being signed secret from the signer.

§Regular signature scheme example

use rsa::{RsaPrivateKey, RsaPublicKey};
use sha2::{Sha256, Digest};

// Set up rng and message
let mut rng = rand::thread_rng();;
let message = b"NEVER GOING TO GIVE YOU UP";

// Create the keys
let signer_priv_key = RsaPrivateKey::new(&mut rng, 2048).unwrap();
let signer_pub_key: RsaPublicKey = signer_priv_key.clone().into();

// Apply a standard digest to the message
let mut hasher = Sha256::new();
hasher.update(message);
let digest = hasher.finalize();

// Obtain a signture
let signature = xcbc_rsa_fdh::sign::<Sha256, _>(&mut rng, &signer_priv_key, &digest).unwrap();

// Verify the signature
let ok = xcbc_rsa_fdh::verify::<Sha256, _>(&signer_pub_key, &digest, &signature);
assert!(ok.is_ok());

Modules§

  • A blind signature scheme that that supports blind-signing to keep the message being signed secret from the signer.

Enums§

Functions§