Struct openssl::symm::Cipher

source ·
pub struct Cipher(/* private fields */);
Expand description

Represents a particular cipher algorithm.

See OpenSSL doc at EVP_EncryptInit for more information on each algorithms.

Implementations§

source§

impl Cipher

source

pub fn from_nid(nid: Nid) -> Option<Cipher>

Looks up the cipher for a certain nid.

This corresponds to EVP_get_cipherbynid

source

pub fn nid(&self) -> Nid

Returns the cipher’s Nid.

This corresponds to EVP_CIPHER_nid

source

pub fn aes_128_ecb() -> Cipher

source

pub fn aes_128_cbc() -> Cipher

source

pub fn aes_128_xts() -> Cipher

source

pub fn aes_128_ctr() -> Cipher

source

pub fn aes_128_cfb1() -> Cipher

source

pub fn aes_128_cfb128() -> Cipher

source

pub fn aes_128_cfb8() -> Cipher

source

pub fn aes_128_gcm() -> Cipher

source

pub fn aes_128_ccm() -> Cipher

source

pub fn aes_128_ofb() -> Cipher

source

pub fn aes_128_ocb() -> Cipher

Requires OpenSSL 1.1.0 or newer.

source

pub fn aes_192_ecb() -> Cipher

source

pub fn aes_192_cbc() -> Cipher

source

pub fn aes_192_ctr() -> Cipher

source

pub fn aes_192_cfb1() -> Cipher

source

pub fn aes_192_cfb128() -> Cipher

source

pub fn aes_192_cfb8() -> Cipher

source

pub fn aes_192_gcm() -> Cipher

source

pub fn aes_192_ccm() -> Cipher

source

pub fn aes_192_ofb() -> Cipher

source

pub fn aes_192_ocb() -> Cipher

Requires OpenSSL 1.1.0 or newer.

source

pub fn aes_256_ecb() -> Cipher

source

pub fn aes_256_cbc() -> Cipher

source

pub fn aes_256_xts() -> Cipher

source

pub fn aes_256_ctr() -> Cipher

source

pub fn aes_256_cfb1() -> Cipher

source

pub fn aes_256_cfb128() -> Cipher

source

pub fn aes_256_cfb8() -> Cipher

source

pub fn aes_256_gcm() -> Cipher

source

pub fn aes_256_ccm() -> Cipher

source

pub fn aes_256_ofb() -> Cipher

source

pub fn aes_256_ocb() -> Cipher

Requires OpenSSL 1.1.0 or newer.

source

pub fn bf_cbc() -> Cipher

source

pub fn bf_ecb() -> Cipher

source

pub fn bf_cfb64() -> Cipher

source

pub fn bf_ofb() -> Cipher

source

pub fn des_cbc() -> Cipher

source

pub fn des_ecb() -> Cipher

source

pub fn des_ede3() -> Cipher

source

pub fn des_ede3_cbc() -> Cipher

source

pub fn des_ede3_ecb() -> Cipher

source

pub fn des_ede3_cfb64() -> Cipher

source

pub fn des_ede3_cfb8() -> Cipher

source

pub fn des_ede3_ofb() -> Cipher

source

pub fn rc4() -> Cipher

source

pub fn camellia_128_cbc() -> Cipher

source

pub fn camellia_128_ecb() -> Cipher

source

pub fn camellia_128_ofb() -> Cipher

source

pub fn camellia_128_cfb128() -> Cipher

source

pub fn camellia_192_cbc() -> Cipher

source

pub fn camellia_192_ecb() -> Cipher

source

pub fn camellia_192_ofb() -> Cipher

source

pub fn camellia_192_cfb128() -> Cipher

source

pub fn camellia_256_cbc() -> Cipher

source

pub fn camellia_256_ecb() -> Cipher

source

pub fn camellia_256_ofb() -> Cipher

source

pub fn camellia_256_cfb128() -> Cipher

source

pub fn cast5_cbc() -> Cipher

source

pub fn cast5_ecb() -> Cipher

source

pub fn cast5_ofb() -> Cipher

source

pub fn cast5_cfb64() -> Cipher

source

pub fn chacha20() -> Cipher

Requires OpenSSL 1.1.0 or newer.

source

pub fn chacha20_poly1305() -> Cipher

Requires OpenSSL 1.1.0 or newer.

source

pub fn seed_cbc() -> Cipher

source

pub fn seed_cfb128() -> Cipher

source

pub fn seed_ecb() -> Cipher

source

pub fn seed_ofb() -> Cipher

source

pub fn sm4_ecb() -> Cipher

source

pub fn sm4_cbc() -> Cipher

source

pub fn sm4_ctr() -> Cipher

source

pub fn sm4_cfb128() -> Cipher

source

pub fn sm4_ofb() -> Cipher

source

pub unsafe fn from_ptr(ptr: *const EVP_CIPHER) -> Cipher

Creates a Cipher from a raw pointer to its OpenSSL type.

§Safety

The caller must ensure the pointer is valid for the 'static lifetime.

source

pub fn as_ptr(&self) -> *const EVP_CIPHER

source

pub fn key_len(&self) -> usize

Returns the length of keys used with this cipher.

source

pub fn iv_len(&self) -> Option<usize>

Returns the length of the IV used with this cipher, or None if the cipher does not use an IV.

source

pub fn block_size(&self) -> usize

Returns the block size of the cipher.

§Note

Stream ciphers such as RC4 have a block size of 1.

Trait Implementations§

source§

impl Clone for Cipher

source§

fn clone(&self) -> Cipher

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl PartialEq for Cipher

source§

fn eq(&self, other: &Cipher) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Cipher

source§

impl Eq for Cipher

source§

impl Send for Cipher

source§

impl StructuralPartialEq for Cipher

source§

impl Sync for Cipher

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.