Struct ed25519::pkcs8::KeypairBytes
source · [−]pkcs8
only.Expand description
Ed25519 keypair serialized as bytes.
This type is primarily useful for decoding/encoding PKCS#8 private key files (either DER or PEM) encoded using the following traits:
DecodePrivateKey
: decode DER or PEM encoded PKCS#8 private key.EncodePrivateKey
: encode DER or PEM encoded PKCS#8 private key.
PKCS#8 private key files encoded with PEM begin with:
-----BEGIN PRIVATE KEY-----
Note that this type operates on raw bytes and performs no validation that keys represent valid Ed25519 field elements.
Fields
secret_key: [u8; 32]
Ed25519 secret key.
Little endian serialization of an element of the Curve25519 scalar field, prior to “clamping” (i.e. setting/clearing bits to ensure the scalar is actually a valid field element)
public_key: Option<[u8; 32]>
Ed25519 public key (if available).
Compressed Edwards-y encoded curve point.
Implementations
Trait Implementations
sourceimpl Debug for KeypairBytes
impl Debug for KeypairBytes
sourceimpl DecodePrivateKey for KeypairBytes
impl DecodePrivateKey for KeypairBytes
sourceimpl Drop for KeypairBytes
impl Drop for KeypairBytes
sourceimpl EncodePrivateKey for KeypairBytes
Available on crate feature alloc
only.
impl EncodePrivateKey for KeypairBytes
alloc
only.sourcefn to_pkcs8_der(&self) -> Result<SecretDocument>
fn to_pkcs8_der(&self) -> Result<SecretDocument>
Serialize a [SecretDocument
] containing a PKCS#8-encoded private key.
sourcefn to_pkcs8_pem(
&self,
line_ending: LineEnding
) -> Result<Zeroizing<String>, Error>
fn to_pkcs8_pem(
&self,
line_ending: LineEnding
) -> Result<Zeroizing<String>, Error>
Serialize this private key as PEM-encoded PKCS#8 with the given LineEnding
.
sourceimpl FromStr for KeypairBytes
Available on crate feature pem
only.
impl FromStr for KeypairBytes
pem
only.sourceimpl TryFrom<&'_ KeypairBytes> for PublicKeyBytes
impl TryFrom<&'_ KeypairBytes> for PublicKeyBytes
type Error = Error
type Error = Error
The type returned in the event of a conversion error.
sourcefn try_from(keypair: &KeypairBytes) -> Result<PublicKeyBytes>
fn try_from(keypair: &KeypairBytes) -> Result<PublicKeyBytes>
Performs the conversion.
sourceimpl TryFrom<KeypairBytes> for PublicKeyBytes
impl TryFrom<KeypairBytes> for PublicKeyBytes
type Error = Error
type Error = Error
The type returned in the event of a conversion error.
sourcefn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes>
fn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes>
Performs the conversion.
sourceimpl TryFrom<PrivateKeyInfo<'_>> for KeypairBytes
impl TryFrom<PrivateKeyInfo<'_>> for KeypairBytes
Auto Trait Implementations
impl RefUnwindSafe for KeypairBytes
impl Send for KeypairBytes
impl Sync for KeypairBytes
impl Unpin for KeypairBytes
impl UnwindSafe for KeypairBytes
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