Ecies

Struct Ecies 

Source
pub struct Ecies<K, E, A> { /* private fields */ }
Expand description

Generic ECIES instance

Implementations§

Source§

impl<K: Key, E, A> Ecies<K, E, A>

Source

pub fn new<T: IntoPublicKey<K>>(recipient_public_key: T) -> Self

Create a new ECIES<K, E, A> instance given a recipient_public_key compatible with K

Source

pub fn try_new<T: TryIntoPublicKey<K>>( recipient_public_key: T, ) -> Result<Self, KeyError>

Source§

impl<K, E, A> Ecies<K, E, A>
where K: EciesMacEncryptionSupport + Key + GenerateEphemeralKey + KeyExchange + DeriveKeyMaterial, E: EciesMacEncryptionSupport + Encryption + GenerateNonce + TakeEncryptionKey, A: Mac + TakeMacKey,

Source

pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, EciesError>

Encrypt plaintext using the ECIES-MAC variant

Source§

impl<K, E, A> Ecies<K, E, A>
where K: EciesMacDecryptionSupport + Key + TakeEphemeralKey + KeyExchange + DeriveKeyMaterial, E: EciesMacDecryptionSupport + Encryption + TakeNonce + TakeEncryptionKey, A: Mac + TakeMac,

Source

pub fn decrypt<T: IntoSecretKeyRef<K>>( recipient_secret_key: &T, ciphertext: &[u8], ) -> Result<Vec<u8>, EciesError>

Decrypt ciphertext using the ECIES-MAC variant, given the recipient_secret_key it was encrypted for

Source§

impl<K, E> Ecies<K, E, Aead>
where K: EciesAeadEncryptionSupport + Key + GenerateEphemeralKey + KeyExchange + DeriveKeyMaterial, E: EciesAeadEncryptionSupport + Encryption + GenerateNonce + TakeEncryptionKey,

Source

pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, EciesError>

Encrypt plaintext using the ECIES-AEAD variant

Source§

impl<K, E> Ecies<K, E, Aead>
where K: EciesAeadDecryptionSupport + Key + TakeEphemeralKey + KeyExchange + DeriveKeyMaterial, E: EciesAeadDecryptionSupport + Encryption + TakeNonce + TakeEncryptionKey,

Source

pub fn decrypt<T: IntoSecretKeyRef<K>>( recipient_secret_key: &T, ciphertext: &[u8], ) -> Result<Vec<u8>, EciesError>

Decrypt ciphertext using the ECIES-AEAD variant, given the recipient_secret_key it was encrypted for

Source§

impl<K, E> Ecies<K, E, Syn>
where K: EciesSynEncryptionSupport + Key + GenerateEphemeralKey + KeyExchange + DeriveKeyMaterial, E: EciesSynEncryptionSupport + Encryption + TakeNonce + TakeEncryptionKey,

Source

pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>, EciesError>

Encrypt plaintext using the ECIES-SYN variant

Source§

impl<K, E> Ecies<K, E, Syn>
where K: EciesSynDecryptionSupport + Key + TakeEphemeralKey + KeyExchange + DeriveKeyMaterial, E: EciesSynDecryptionSupport + Encryption + TakeNonce + TakeEncryptionKey,

Source

pub fn decrypt<T: IntoSecretKeyRef<K>>( recipient_secret_key: &T, ciphertext: &[u8], ) -> Result<Vec<u8>, EciesError>

Decrypt ciphertext using the ECIES-SYN variant, given the recipient_secret_key it was encrypted for

Auto Trait Implementations§

§

impl<K, E, A> Freeze for Ecies<K, E, A>
where K: Freeze,

§

impl<K, E, A> RefUnwindSafe for Ecies<K, E, A>

§

impl<K, E, A> Send for Ecies<K, E, A>
where K: Send, E: Send, A: Send,

§

impl<K, E, A> Sync for Ecies<K, E, A>
where K: Sync, E: Sync, A: Sync,

§

impl<K, E, A> Unpin for Ecies<K, E, A>
where K: Unpin, E: Unpin, A: Unpin,

§

impl<K, E, A> UnwindSafe for Ecies<K, E, A>
where K: UnwindSafe, E: UnwindSafe, A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> IntoPublicKey<U> for T
where U: PublicKeyFrom<T>,

Source§

fn into_pk(self) -> U

Source§

impl<T, U> IntoSecretKey<U> for T
where U: SecretKeyFrom<T>,

Source§

fn into_sk(self) -> <U as Key>::SecretKey

Source§

impl<T, U> IntoSecretKeyRef<U> for T
where U: SecretKeyFromRef<T>,

Source§

fn into_sk_ref(&self) -> &<U as Key>::SecretKey

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T, U> TryIntoPublicKey<U> for T
where U: TryPublicKeyFrom<T>,

Source§

impl<T, U> TryIntoSecretKey<U> for T
where U: TrySecretKeyFrom<T>,

Source§

fn try_into_sk(self) -> Result<<U as Key>::SecretKey, KeyError>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V