Skip to main content

SignatureKeyPair

Struct SignatureKeyPair 

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

A signature key pair for the basic credential.

This can be used as keys to implement the MLS basic credential. It is a simple private and public key pair with corresponding signature scheme.

Implementations§

Source§

impl SignatureKeyPair

Source

pub fn new(signature_scheme: SignatureScheme) -> Result<Self, CryptoError>

Generates a fresh signature keypair using the SignatureScheme.

Source

pub fn from_raw( signature_scheme: SignatureScheme, private: Vec<u8>, public: Vec<u8>, ) -> Self

Create a new signature key pair from the raw keys.

Source

pub fn id(&self) -> StorageId

Source

pub fn store<T>(&self, store: &T) -> Result<(), T::Error>
where T: StorageProvider<CURRENT_VERSION>,

Store this signature key pair in the key store.

Source

pub fn read( store: &impl StorageProvider<CURRENT_VERSION>, public_key: &[u8], signature_scheme: SignatureScheme, ) -> Option<Self>

Read a signature key pair from the key store.

Source

pub fn delete<T: StorageProvider<CURRENT_VERSION>>( store: &T, public_key: &[u8], signature_scheme: SignatureScheme, ) -> Result<(), T::Error>

Delete a signature key pair from the key store.

Source

pub fn public(&self) -> &[u8]

Get the public key as byte slice.

Source

pub fn to_public_vec(&self) -> Vec<u8>

Get the public key as byte vector.

Source

pub fn signature_scheme(&self) -> SignatureScheme

Get the SignatureScheme of this signature key.

Trait Implementations§

Source§

impl Debug for SignatureKeyPair

Source§

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

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

impl<'de> Deserialize<'de> for SignatureKeyPair

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Deserialize for SignatureKeyPair

Source§

fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>

This function deserializes the bytes from the provided a std::io::Read and returns the populated struct. Read more
Source§

fn tls_deserialize_exact(bytes: impl AsRef<[u8]>) -> Result<Self, Error>
where Self: Sized,

This function deserializes the provided bytes and returns the populated struct. All bytes must be consumed. Read more
Source§

impl DeserializeBytes for SignatureKeyPair

Source§

fn tls_deserialize_bytes(bytes: &[u8]) -> Result<(Self, &[u8]), Error>

This function deserializes the bytes from the provided a &[u8] and returns the populated struct, as well as the remaining slice. Read more
Source§

fn tls_deserialize_exact_bytes(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

This function deserializes the provided bytes and returns the populated struct. All bytes must be consumed. Read more
Source§

impl Serialize for &SignatureKeyPair

Source§

fn tls_serialize<W: Write>(&self, writer: &mut W) -> Result<usize, Error>

Serialize self and write it to the writer. The function returns the number of bytes written to writer.
Source§

fn tls_serialize_detached(&self) -> Result<Vec<u8>, Error>

Serialize self and return it as a byte vector.
Source§

impl Serialize for SignatureKeyPair

Source§

fn tls_serialize<W: Write>(&self, writer: &mut W) -> Result<usize, Error>

Serialize self and write it to the writer. The function returns the number of bytes written to writer.
Source§

fn tls_serialize_detached(&self) -> Result<Vec<u8>, Error>

Serialize self and return it as a byte vector.
Source§

impl Serialize for SignatureKeyPair

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Signer for SignatureKeyPair

Source§

fn sign(&self, payload: &[u8]) -> Result<Vec<u8>, SignerError>

Sign the provided payload. Read more
Source§

fn signature_scheme(&self) -> SignatureScheme

The SignatureScheme of this signer.
Source§

impl Size for &SignatureKeyPair

Source§

impl Size for SignatureKeyPair

Source§

impl Entity<CURRENT_VERSION> for SignatureKeyPair

Source§

impl SignatureKeyPair<CURRENT_VERSION> for SignatureKeyPair

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 = 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>,

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

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,