Files
Tony Arcieri 1b47ec5298 dsa: impl Generate for Components and SigningKey (#1372)
This renames the old `SigningKey::generate` to
`try_generate_from_rng_with_components`, having the new one generate
random `Components` with a 3072-bit modulus size, which is now the
`Default` for `KeySize`.
2026-06-06 11:27:17 -06:00

14 lines
458 B
Rust

#![cfg(feature = "hazmat")]
use dsa::{Components, KeySize, SigningKey};
use getrandom::{SysRng, rand_core::UnwrapErr};
fn main() {
let mut rng = UnwrapErr(SysRng);
let components =
Components::try_generate_from_rng_with_key_size(&mut rng, KeySize::DSA_2048_256).unwrap();
let signing_key =
SigningKey::try_generate_from_rng_with_components(&mut rng, components).unwrap();
let _verifying_key = signing_key.verifying_key();
}