pub struct SigningKeyPair {
    signing_key: SigningPrivateKey,
    context: AssociatedData,
}
Expand description

An ECDSA signing key pair, including a public component for verifying signatures, a private component for creating them, and context about the key pair.

This can be generated locally by the client or remotely by the server.

Fields§

§signing_key: SigningPrivateKey§context: AssociatedData

Implementations§

source§

impl SigningKeyPair

source

fn generate( rng: &mut (impl CryptoRng + RngCore), context: &AssociatedData ) -> Self

Create a new SigningKeyPair with the given associated data.

source

fn domain_separator() -> &'static str

Domain separator for use in serializing signing keypairs.

source

pub fn public_key(&self) -> SigningPublicKey

Retrieve the public portion of the key.

source

pub(super) fn context(&self) -> &AssociatedData

Retrieve the context associated with the signing key.

source

pub fn remote_generate( rng: &mut (impl CryptoRng + RngCore), user_id: &UserId, key_id: &KeyId ) -> Self

Create a new SigningKeyPair. This must be run by the server.

source

pub fn import_and_encrypt( key_material: &[u8], rng: &mut (impl CryptoRng + RngCore), storage_key: &StorageKey, user_id: &UserId, key_id: &KeyId ) -> Result<(Self, Encrypted<Self>), LockKeeperError>

Create a SigningKeyPair from an imported key and encrypt it for storage at a server, under a key known only to the client.

This is part of the local import with remote backup flow and must be run by the client. In this flow, the key server will only receive an Encrypted<SigningKeyPair>, not the cleartext.

key_material should be a scalar value formatted in big endian. See k256 documentation for details.

This function takes the following steps:

  1. Format the key_material as a signing key
  2. Encrypt it under the StorageKey, using an AEAD scheme
source

pub fn create_and_encrypt( rng: &mut (impl CryptoRng + RngCore), storage_key: &StorageKey, user_id: &UserId, key_id: &KeyId ) -> Result<(Self, Encrypted<Self>), LockKeeperError>

Create and encrypt a new signing key for storage at a server, under a key known only to the client.

This is part of the local signing key generation flow and must be run by the client. In this flow the key server will only receive an Encrypted<SigningKeyPair>, not the cleartext.

This function takes the following steps:

  1. Generates a new signing key
  2. Encrypt it under the StorageKey, using an AEAD scheme

Trait Implementations§

source§

impl Clone for SigningKeyPair

source§

fn clone(&self) -> SigningKeyPair

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SigningKeyPair

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<SigningKeyPair> for Export

source§

fn from(key_pair: SigningKeyPair) -> Self

Converts to this type from the input type.
source§

impl PartialEq for SigningKeyPair

source§

fn eq(&self, other: &SigningKeyPair) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<RetrievedSecret> for SigningKeyPair

§

type Error = LockKeeperError

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

fn try_from(secret: RetrievedSecret) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<SigningKeyPair> for Vec<u8>

§

type Error = CryptoError

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

fn try_from(key_pair: SigningKeyPair) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Vec<u8>> for SigningKeyPair

§

type Error = CryptoError

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

fn try_from(value: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for SigningKeyPair

source§

impl StructuralPartialEq for SigningKeyPair

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more