Skip to main content

SigningIdentity

Struct SigningIdentity 

Source
pub struct SigningIdentity { /* private fields */ }
Expand description

An implementation-owned signing identity with both required private keys.

No runtime randomness is needed to use this type. Applications may derive or securely load the two signing keys according to their own key-management policy before constructing the identity.

Implementations§

Source§

impl SigningIdentity

Source

pub fn new( classical: SigningKey, post_quantum: MlDsaSigningKey<MlDsa65>, ) -> Self

Combines application-managed Ed25519 and ML-DSA-65 signing keys.

Examples found in repository?
examples/wire_benchmark.rs (lines 24-27)
23fn signed_wire(body: Body) -> Vec<u8> {
24    let signer = SigningIdentity::new(
25        SigningKey::from_bytes(&[41; 32]),
26        MlDsaSigningKey::<MlDsa65>::from_seed(&B32::from([41; 32])),
27    );
28    let recipient = SigningIdentity::new(
29        SigningKey::from_bytes(&[42; 32]),
30        MlDsaSigningKey::<MlDsa65>::from_seed(&B32::from([42; 32])),
31    );
32    Envelope::sign(
33        &signer,
34        FederationId::from_bytes([1; 32]),
35        AttemptId::from_bytes([2; 16]),
36        recipient.endpoint(),
37        body,
38    )
39    .expect("bounded test envelope")
40    .encode()
41    .expect("canonical wire")
42}
Source

pub fn endpoint(&self) -> EndpointIdentity

Returns the stable public endpoint identity corresponding to these keys.

Examples found in repository?
examples/wire_benchmark.rs (line 36)
23fn signed_wire(body: Body) -> Vec<u8> {
24    let signer = SigningIdentity::new(
25        SigningKey::from_bytes(&[41; 32]),
26        MlDsaSigningKey::<MlDsa65>::from_seed(&B32::from([41; 32])),
27    );
28    let recipient = SigningIdentity::new(
29        SigningKey::from_bytes(&[42; 32]),
30        MlDsaSigningKey::<MlDsa65>::from_seed(&B32::from([42; 32])),
31    );
32    Envelope::sign(
33        &signer,
34        FederationId::from_bytes([1; 32]),
35        AttemptId::from_bytes([2; 16]),
36        recipient.endpoint(),
37        body,
38    )
39    .expect("bounded test envelope")
40    .encode()
41    .expect("canonical wire")
42}

Trait Implementations§

Source§

impl EndpointSigner for SigningIdentity

Source§

fn endpoint(&self) -> EndpointIdentity

Returns the complete identity used to address and authenticate envelopes.
Source§

fn sign_classical(&self, message: &[u8]) -> [u8; 64]

Produces the canonical Ed25519 signature for the supplied transcript.
Source§

fn sign_post_quantum(&self, message: &[u8]) -> [u8; 3309]

Produces the canonical ML-DSA-65 signature for the supplied transcript.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.