Struct ed25519_dalek::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§
source§impl KeypairBytes
impl KeypairBytes
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, Error>
fn to_pkcs8_der(&self) -> Result<SecretDocument, Error>
Serialize a
SecretDocument
containing a PKCS#8-encoded private key.§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
.§fn write_pkcs8_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
fn write_pkcs8_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
Available on crate feature
std
only.Write ASN.1 DER-encoded PKCS#8 private key to the given path
§fn write_pkcs8_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<(), Error>
fn write_pkcs8_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<(), Error>
Available on crate features
pem
and std
only.Write ASN.1 DER-encoded PKCS#8 private key to the given path
source§impl From<&SigningKey> for KeypairBytes
impl From<&SigningKey> for KeypairBytes
source§fn from(signing_key: &SigningKey) -> KeypairBytes
fn from(signing_key: &SigningKey) -> KeypairBytes
Converts to this type from the input type.
source§impl From<SigningKey> for KeypairBytes
impl From<SigningKey> for KeypairBytes
source§fn from(signing_key: SigningKey) -> KeypairBytes
fn from(signing_key: SigningKey) -> KeypairBytes
Converts to this type from the input type.
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, Error>
fn try_from(keypair: &KeypairBytes) -> Result<PublicKeyBytes, Error>
Performs the conversion.
source§impl TryFrom<&KeypairBytes> for SigningKey
impl TryFrom<&KeypairBytes> for SigningKey
source§impl TryFrom<KeypairBytes> for PublicKeyBytes
impl TryFrom<KeypairBytes> for PublicKeyBytes
source§fn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes, Error>
fn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes, Error>
Performs the conversion.
source§impl TryFrom<KeypairBytes> for SigningKey
impl TryFrom<KeypairBytes> for SigningKey
source§impl TryFrom<PrivateKeyInfo<'_>> for KeypairBytes
impl TryFrom<PrivateKeyInfo<'_>> for KeypairBytes
source§fn try_from(private_key: PrivateKeyInfo<'_>) -> Result<KeypairBytes, Error>
fn try_from(private_key: PrivateKeyInfo<'_>) -> Result<KeypairBytes, Error>
Performs the conversion.
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
§impl<T> DecodePrivateKey for T
impl<T> DecodePrivateKey for T
§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).
§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