pub struct RsaSpec {
pub bits: usize,
pub exponent: u32,
}Expand description
Specification for RSA key generation.
This struct defines the parameters for generating RSA keypairs.
§Examples
use uselesskey_rsa::RsaSpec;
// Common preset for JWT RS256 signing
let spec = RsaSpec::rs256();
assert_eq!(spec.bits, 2048);
assert_eq!(spec.exponent, 65537);
// Custom bit size (exponent defaults to 65537)
let spec = RsaSpec::new(4096);
assert_eq!(spec.bits, 4096);Fields§
§bits: usizeRSA modulus size in bits. Must be at least 1024.
exponent: u32Public exponent. Currently only 65537 is supported.
Implementations§
Source§impl RsaSpec
impl RsaSpec
Sourcepub fn rs256() -> Self
pub fn rs256() -> Self
Spec suitable for RS256 JWT signing in most ecosystems.
Returns a spec with 2048 bits and exponent 65537.
§Examples
use uselesskey_rsa::RsaSpec;
let spec = RsaSpec::rs256();
assert_eq!(spec.bits, 2048);
assert_eq!(spec.exponent, 65537);Sourcepub fn stable_bytes(&self) -> [u8; 8]
pub fn stable_bytes(&self) -> [u8; 8]
Stable encoding for cache keys / deterministic derivation.
If you change this, bump the derivation version in uselesskey-core.
§Examples
use uselesskey_rsa::RsaSpec;
let spec = RsaSpec::rs256();
let bytes = spec.stable_bytes();
assert_eq!(bytes.len(), 8);Trait Implementations§
impl Copy for RsaSpec
impl Eq for RsaSpec
impl StructuralPartialEq for RsaSpec
Auto Trait Implementations§
impl Freeze for RsaSpec
impl RefUnwindSafe for RsaSpec
impl Send for RsaSpec
impl Sync for RsaSpec
impl Unpin for RsaSpec
impl UnsafeUnpin for RsaSpec
impl UnwindSafe for RsaSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more