pub enum IdentityKeyPair {
Ed25519 {
private_key_encoded: [u8; 32],
private_key: SigningKey,
public_key: VerifyingKey,
},
MlDsa65 {
private_key_encoded: [u8; 32],
private_key: Box<SigningKey<MlDsa65>>,
public_key: Box<VerifyingKey<MlDsa65>>,
},
}Expand description
A cryptographic identity key-pair for signing challenges.
Variants§
Ed25519
MlDsa65
ML-DSA-65 keys are boxed because their in-memory representation is ~108KB, which causes stack overflows on Windows when stored inline in the enum.
Implementations§
Source§impl IdentityKeyPair
impl IdentityKeyPair
Sourcepub fn generate() -> IdentityKeyPair
pub fn generate() -> IdentityKeyPair
Generate a new identity key-pair using the default algorithm.
Sourcepub fn from_cose(cose_bytes: &[u8]) -> Result<IdentityKeyPair, ProxyError>
pub fn from_cose(cose_bytes: &[u8]) -> Result<IdentityKeyPair, ProxyError>
Deserialize a key pair from COSE key format.
Sourcepub fn identity(&self) -> Identity
pub fn identity(&self) -> Identity
Get the public identity corresponding to this key pair.
The public Identity contains only the public key and can be shared freely.
It is used to verify signatures and identify clients to the proxy.
§Examples
use ap_proxy_protocol::IdentityKeyPair;
let keypair = IdentityKeyPair::generate();
let public_identity = keypair.identity();
// Share the public identity with others
println!("My fingerprint: {:?}", public_identity.fingerprint());Trait Implementations§
Source§impl Clone for IdentityKeyPair
impl Clone for IdentityKeyPair
Source§fn clone(&self) -> IdentityKeyPair
fn clone(&self) -> IdentityKeyPair
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl From<&IdentityKeyPair> for Identity
impl From<&IdentityKeyPair> for Identity
Source§fn from(keypair: &IdentityKeyPair) -> Identity
fn from(keypair: &IdentityKeyPair) -> Identity
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for IdentityKeyPair
impl RefUnwindSafe for IdentityKeyPair
impl Send for IdentityKeyPair
impl Sync for IdentityKeyPair
impl Unpin for IdentityKeyPair
impl UnsafeUnpin for IdentityKeyPair
impl UnwindSafe for IdentityKeyPair
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