Struct lock_keeper::crypto::signing_key::SigningKeyPair
source · 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: AssociatedDataImplementations§
source§impl SigningKeyPair
impl SigningKeyPair
sourcefn generate(
rng: &mut (impl CryptoRng + RngCore),
context: &AssociatedData
) -> Self
fn generate( rng: &mut (impl CryptoRng + RngCore), context: &AssociatedData ) -> Self
Create a new SigningKeyPair with the given associated data.
sourcefn domain_separator() -> &'static str
fn domain_separator() -> &'static str
Domain separator for use in serializing signing keypairs.
sourcepub fn public_key(&self) -> SigningPublicKey
pub fn public_key(&self) -> SigningPublicKey
Retrieve the public portion of the key.
sourcepub(super) fn context(&self) -> &AssociatedData
pub(super) fn context(&self) -> &AssociatedData
Retrieve the context associated with the signing key.
sourcepub fn remote_generate(
rng: &mut (impl CryptoRng + RngCore),
user_id: &UserId,
key_id: &KeyId
) -> Self
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.
sourcepub 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>
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:
- Format the
key_materialas a signing key - Encrypt it under the
StorageKey, using an AEAD scheme
sourcepub fn create_and_encrypt(
rng: &mut (impl CryptoRng + RngCore),
storage_key: &StorageKey,
user_id: &UserId,
key_id: &KeyId
) -> Result<(Self, Encrypted<Self>), LockKeeperError>
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:
- Generates a new signing key
- Encrypt it under the
StorageKey, using an AEAD scheme
Trait Implementations§
source§impl Clone for SigningKeyPair
impl Clone for SigningKeyPair
source§fn clone(&self) -> SigningKeyPair
fn clone(&self) -> SigningKeyPair
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for SigningKeyPair
impl Debug for SigningKeyPair
source§impl From<SigningKeyPair> for Export
impl From<SigningKeyPair> for Export
source§fn from(key_pair: SigningKeyPair) -> Self
fn from(key_pair: SigningKeyPair) -> Self
source§impl PartialEq for SigningKeyPair
impl PartialEq for SigningKeyPair
source§fn eq(&self, other: &SigningKeyPair) -> bool
fn eq(&self, other: &SigningKeyPair) -> bool
self and other values to be equal, and is used
by ==.source§impl TryFrom<RetrievedSecret> for SigningKeyPair
impl TryFrom<RetrievedSecret> for SigningKeyPair
§type Error = LockKeeperError
type Error = LockKeeperError
impl Eq for SigningKeyPair
impl StructuralPartialEq for SigningKeyPair
Auto Trait Implementations§
impl Freeze for SigningKeyPair
impl RefUnwindSafe for SigningKeyPair
impl Send for SigningKeyPair
impl Sync for SigningKeyPair
impl Unpin for SigningKeyPair
impl UnwindSafe for SigningKeyPair
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request