[−][src]Trait bdrck::crypto::key::AbstractKey
An AbstractKey is any cryptographic structure which supports encryption and decryption.
Required methods
fn get_digest(&self) -> Digest
Return a digest/signature computed from this key.
fn encrypt(
&self,
plaintext: &[u8],
nonce: Option<Nonce>
) -> Result<(Option<Nonce>, Vec<u8>), Error>
&self,
plaintext: &[u8],
nonce: Option<Nonce>
) -> Result<(Option<Nonce>, Vec<u8>), Error>
Encrypt the given plaintext with this key. This function optionally takes a nonce as an argument. If this key's encryption algorithm utilizes a nonce, the provided one will be used.
This function returns the ciphertext, as well as a Nonce (if one was used for encryption). If a Nonce was provided, that same Nonce is returned.
fn decrypt(
&self,
nonce: Option<&Nonce>,
ciphertext: &[u8]
) -> Result<Vec<u8>, Error>
&self,
nonce: Option<&Nonce>,
ciphertext: &[u8]
) -> Result<Vec<u8>, Error>
Decrypt the given ciphertext using this key and the nonce which was generated at encryption time (if any), returning the plaintext.
Implementations on Foreign Types
impl AbstractKey for Box<dyn AbstractKey>
[src]
fn get_digest(&self) -> Digest
[src]
fn encrypt(
&self,
plaintext: &[u8],
nonce: Option<Nonce>
) -> Result<(Option<Nonce>, Vec<u8>), Error>
[src]
&self,
plaintext: &[u8],
nonce: Option<Nonce>
) -> Result<(Option<Nonce>, Vec<u8>), Error>
fn decrypt(
&self,
nonce: Option<&Nonce>,
ciphertext: &[u8]
) -> Result<Vec<u8>, Error>
[src]
&self,
nonce: Option<&Nonce>,
ciphertext: &[u8]
) -> Result<Vec<u8>, Error>