Trait recrypt::api::CryptoOps[]

pub trait CryptoOps {
    fn gen_plaintext(&mut self) -> Plaintext;
fn derive_symmetric_key(
        &self,
        decrypted_value: &Plaintext
    ) -> DerivedSymmetricKey;
fn encrypt(
        &mut self,
        plaintext: Plaintext,
        to_public_key: PublicKey,
        public_signing_key: PublicSigningKey,
        private_signing_key: PrivateSigningKey
    ) -> Result<EncryptedValue, ApiErr>;
fn decrypt(
        &self,
        encrypted_value: EncryptedValue,
        private_key: PrivateKey
    ) -> Result<Plaintext, ApiErr>;
fn transform(
        &mut self,
        encrypted_value: EncryptedValue,
        transform_key: TransformKey,
        public_signing_key: PublicSigningKey,
        private_signing_key: PrivateSigningKey
    ) -> Result<EncryptedValue, ApiErr>; }

Encrypt, Decrypt, Transform, and supporting operations.

Required Methods

Using the random_bytes, generate a random element of G_T, which is one of the rth roots of unity in FP12.

Convert our plaintext into a DecryptedSymmetricKey by hashing it.

Encrypt the plaintext to the to_public_key.

Arguments

  • plaintext - value to encrypt.
  • to_public_key - identity to encrypt to.
  • public_signing_key - public signing key of the person (or device) who is encrypting this value
  • private_signing_key - private signing key of the person (or device) who is encrypting this value

Return

EncryptedValue which can be decrypted by the matching private key of to_public_key or ApiErr.

Decrypt the value using private_key.

Arguments

  • encrypted_value - value we want to decrypt.
  • private_key - PrivateKey which we want to use to decrypt the EncryptedValue.

Return

An error if the key didn't match or something was corrupted in the EncryptedValue, otherwise the recovered plaintext.

Transform the value encrypted_value using the transform_key. The returned value can be decrypted by the private key associated to the to_public_key in the transform_key.

The transformed value will be signed using the private_signing_key and will embed the public_signing_key into the returned value.

Implementors