pub fn generate_and_seal(
        signature_alg: SignatureAlg,
        encryption_alg: EncryptionAlg,
        rng: &SecureRandom,
        sealing_key: &[u8],
        nonce: &[u8],
    ) -> Result<(KeyPair, Vec<u8>)> {
        // Ed25519 is the only signature algorithm we presently support
        assert_eq!(signature_alg, SignatureAlg::Ed25519);

        let pkcs8_bytes = ring::signature::Ed25519KeyPair::generate_pkcs8(rng)?;
        let keypair =
            ring::signature::Ed25519KeyPair::from_pkcs8(untrusted::Input::from(&pkcs8_bytes))?;

        let ciphertext = crypto::symmetric::seal(encryption_alg, sealing_key, nonce, &pkcs8_bytes)?;

        let result = KeyPair {
            algorithm: SignatureAlg::Ed25519,
            keypair: keypair,
        };

        Ok((result, ciphertext))
    }
/// Generate a new `KeyPair` and seal it with the given encryption algorithm and key
Generate a new `KeyPair` and seal it with the given encryption algorithm and key
Generate a new ` KeyPair ` and seal it with the given encryption algorithm and key
pub fn generate_and_seal(
        signature_alg: SignatureAlg,
        encryption_alg: EncryptionAlg,
        rng: &SecureRandom,
        sealing_key: &[u8],
        nonce: &[u8],
    ) -> Result<(KeyPair, Vec<u8>)> {
        // Ed25519 is the only signature algorithm we presently support
        assert_eq!(signature_alg, SignatureAlg::Ed25519);
        let pkcs8_bytes = ring::signature::Ed25519KeyPair::generate_pkcs8(rng)?;
        let keypair =
            ring::signature::Ed25519KeyPair::from_pkcs8(untrusted::Input::from(&pkcs8_bytes))?;
        let ciphertext = crypto::symmetric::seal(encryption_alg, sealing_key, nonce, &pkcs8_bytes)?;
        let result = KeyPair {
            algorithm: SignatureAlg::Ed25519,
            keypair: keypair,
        };
        Ok((result, ciphertext))
    }
pub fn generate_and_seal ( signature_alg : SignatureAlg , encryption_alg : EncryptionAlg , rng : & SecureRandom , sealing_key : & [ u8 ] , nonce : & [ u8 ] , ) -> Result < ( KeyPair , Vec < u8 > ) > { // Ed25519 is the only signature algorithm we presently support assert_eq ! ( signature_alg SignatureAlg Ed25519 ) ; let pkcs8_bytes = ring :: signature :: Ed25519KeyPair :: generate_pkcs8 ( rng ) ? ; let keypair = ring :: signature :: Ed25519KeyPair :: from_pkcs8 ( untrusted :: Input :: from ( & pkcs8_bytes ) ) ? ; let ciphertext = crypto :: symmetric :: seal ( encryption_alg , sealing_key , nonce , & pkcs8_bytes ) ? ; let result = KeyPair { algorithm : SignatureAlg :: Ed25519 , keypair : keypair , } ; Ok ( ( result , ciphertext ) ) }
Generate a new `KeyPair` and seal it with the given encryption algorithm and key
Generate a new ` KeyPair ` and seal it with the given encryption algorithm and key
signature_alg
SignatureAlg
encryption_alg
EncryptionAlg
rng
&SecureRandom
sealing_key
&[u8]
nonce
&[u8]
signature_alg
SignatureAlg
encryption_alg
EncryptionAlg
rng
&SecureRandom
sealing_key
&[u8]
nonce
&[u8]