Struct ruma_signatures::Ed25519KeyPair
source · [−]pub struct Ed25519KeyPair { /* private fields */ }
Expand description
An Ed25519 key pair.
Implementations
sourceimpl Ed25519KeyPair
impl Ed25519KeyPair
sourcepub fn new(
oid: ObjectIdentifier,
privkey: &[u8],
pubkey: Option<&[u8]>,
version: String
) -> Result<Self, Error>
pub fn new(
oid: ObjectIdentifier,
privkey: &[u8],
pubkey: Option<&[u8]>,
version: String
) -> Result<Self, Error>
Create a key pair from its constituent parts.
sourcepub fn from_der(document: &[u8], version: String) -> Result<Self, Error>
pub fn from_der(document: &[u8], version: String) -> Result<Self, Error>
Initializes a new key pair.
Parameters
- document: PKCS#8 v1/v2 DER-formatted document containing the private (and optionally public) key.
- version: The “version” of the key used for this signature. Versions are used as an identifier to distinguish signatures generated from different keys but using the same algorithm on the same homeserver.
Errors
Returns an error if the public and private keys provided are invalid for the implementing algorithm.
Returns an error when the PKCS#8 document had a public key, but it doesn’t match the one generated from the private key. This is a fallback and extra validation against corruption or
sourcepub fn from_pkcs8_oak(
oak: PrivateKeyInfo<'_>,
version: String
) -> Result<Self, Error>
pub fn from_pkcs8_oak(
oak: PrivateKeyInfo<'_>,
version: String
) -> Result<Self, Error>
Constructs a key pair from pkcs8::PrivateKeyInfo
.
sourcepub fn from_pkcs8_pki(
oak: PrivateKeyInfo<'_>,
version: String
) -> Result<Self, Error>
pub fn from_pkcs8_pki(
oak: PrivateKeyInfo<'_>,
version: String
) -> Result<Self, Error>
Constructs a key pair from pkcs8::PrivateKeyInfo
.
Trait Implementations
sourceimpl Debug for Ed25519KeyPair
impl Debug for Ed25519KeyPair
Auto Trait Implementations
impl RefUnwindSafe for Ed25519KeyPair
impl Send for Ed25519KeyPair
impl Sync for Ed25519KeyPair
impl Unpin for Ed25519KeyPair
impl UnwindSafe for Ed25519KeyPair
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more