pub fn pkcs8_of_dalek_keypair(
    key_pair: &ed25519_dalek::Keypair,
) -> Result<Vec<u8>, InvalidDalekKey> {
    let private_key = internal_types::SecretKey::try_from(key_pair.secret.as_bytes().as_ref())
        .map_err(|_| InvalidDalekKey::InvalidSecretKey)?;
    let public_key = internal_types::PublicKey::try_from(key_pair.public.as_bytes().as_ref())
        .map_err(|_| InvalidDalekKey::InvalidPublicKey)?;
    Ok(private_key.to_der(&public_key))
}
/// Return the unencrypted PKCS#8 v2 encoding of an Ed25519 dalek keypair
///
/// This is useful when one needs to export a key from dalek to some other
/// library such as ring. The exported PKCS8 package contains both the public
/// and private keys.
///
/// # Returns
/// * The key in PKCS8 v2 format, using binary DER encoding
Return the unencrypted PKCS#8 v2 encoding of an Ed25519 dalek keypair
This is useful when one needs to export a key from dalek to some other
library such as ring. The exported PKCS8 package contains both the public
and private keys.
Return the unencrypted PKCS#8 v2 encoding of an Ed25519 dalek keypair This is useful when one needs to export a key from dalek to some other library such as ring . The exported PKCS8 package contains both the public and private keys .
pub fn pkcs8_of_dalek_keypair(
    key_pair: &ed25519_dalek::Keypair,
) -> Result<Vec<u8>, InvalidDalekKey> {
    let private_key = internal_types::SecretKey::try_from(key_pair.secret.as_bytes().as_ref())
        .map_err(|_| InvalidDalekKey::InvalidSecretKey)?;
    let public_key = internal_types::PublicKey::try_from(key_pair.public.as_bytes().as_ref())
        .map_err(|_| InvalidDalekKey::InvalidPublicKey)?;
    Ok(private_key.to_der(&public_key))
}
pub fn pkcs8_of_dalek_keypair ( key_pair : & ed25519_dalek :: Keypair , ) -> Result < Vec < u8 > , InvalidDalekKey > { let private_key = internal_types :: SecretKey :: try_from ( key_pair . secret . as_bytes ( ) . as_ref ( ) ) . map_err ( | _ | InvalidDalekKey :: InvalidSecretKey ) ? ; let public_key = internal_types :: PublicKey :: try_from ( key_pair . public . as_bytes ( ) . as_ref ( ) ) . map_err ( | _ | InvalidDalekKey :: InvalidPublicKey ) ? ; Ok ( private_key . to_der ( & public_key ) ) }
Return the unencrypted PKCS#8 v2 encoding of an Ed25519 dalek keypair
This is useful when one needs to export a key from dalek to some other
library such as ring.
Return the unencrypted PKCS#8 v2 encoding of an Ed25519 dalek keypair This is useful when one needs to export a key from dalek to some other library such as ring .
key_pair
&ed25519_dalek::Keypair
The key in PKCS8 v2 format, using binary DER encoding
The key in PKCS8 v2 format using binary DER encoding
key_pair
&ed25519_dalek::Keypair