mirror of
https://github.com/RustCrypto/signatures
synced 2026-06-21 13:45:42 +00:00
1b47ec5298
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`.
14 lines
458 B
Rust
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();
|
|
}
|