Struct ed25519::pkcs8::KeypairBytes
source · pub struct KeypairBytes {
pub secret_key: [u8; 32],
pub public_key: Option<PublicKeyBytes>,
}
Available on crate feature
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<PublicKeyBytes>
Ed25519 public key (if available).
Compressed Edwards-y encoded curve point.
Implementations§
Trait Implementations§
source§impl Debug for KeypairBytes
impl Debug for KeypairBytes
source§impl Drop for KeypairBytes
impl Drop for KeypairBytes
source§impl EncodePrivateKey for KeypairBytes
Available on crate feature alloc
only.
impl EncodePrivateKey for KeypairBytes
Available on crate feature
alloc
only.source§fn to_pkcs8_der(&self) -> Result<SecretDocument>
fn to_pkcs8_der(&self) -> Result<SecretDocument>
Serialize a
SecretDocument
containing a PKCS#8-encoded private key.source§fn to_pkcs8_pem(
&self,
line_ending: LineEnding
) -> Result<Zeroizing<String>, Error>
fn to_pkcs8_pem( &self, line_ending: LineEnding ) -> Result<Zeroizing<String>, Error>
Available on crate feature
pem
only.Serialize this private key as PEM-encoded PKCS#8 with the given [
LineEnding
].source§impl FromStr for KeypairBytes
Available on crate feature pem
only.
impl FromStr for KeypairBytes
Available on crate feature
pem
only.source§impl TryFrom<&[u8]> for KeypairBytes
impl TryFrom<&[u8]> for KeypairBytes
source§impl TryFrom<&KeypairBytes> for PublicKeyBytes
impl TryFrom<&KeypairBytes> for PublicKeyBytes
source§fn try_from(keypair: &KeypairBytes) -> Result<PublicKeyBytes>
fn try_from(keypair: &KeypairBytes) -> Result<PublicKeyBytes>
Performs the conversion.
source§impl TryFrom<KeypairBytes> for PublicKeyBytes
impl TryFrom<KeypairBytes> for PublicKeyBytes
source§fn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes>
fn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes>
Performs the conversion.
source§impl 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§
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
Mutably borrows from an owned value. Read more
source§impl<T> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,
impl<T> DecodePrivateKey for Twhere T: for<'a> TryFrom<PrivateKeyInfo<'a>, Error = Error>,
source§fn from_pkcs8_der(bytes: &[u8]) -> Result<T, Error>
fn from_pkcs8_der(bytes: &[u8]) -> Result<T, Error>
Deserialize PKCS#8 private key from ASN.1 DER-encoded data
(binary format).
source§fn from_pkcs8_pem(s: &str) -> Result<Self, Error>
fn from_pkcs8_pem(s: &str) -> Result<Self, Error>
Available on crate feature
pem
only.Deserialize PKCS#8-encoded private key from PEM. Read more