# Struct openssl::symm::Cipher [−] [src]

    pub struct Cipher(_);

Represents a particular cipher algorithm.

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

## Implementations

### `impl Cipher` [src]

#### `pub fn from_nid(nid: Nid) -> Option<Cipher>` [src]

Looks up the cipher for a certain nid.

This corresponds to `EVP_get_cipherbynid`

#### `pub fn aes_128_ecb() -> Cipher` [src]

#### `pub fn aes_128_cbc() -> Cipher` [src]

#### `pub fn aes_128_xts() -> Cipher` [src]

#### `pub fn aes_128_ctr() -> Cipher` [src]

#### `pub fn aes_128_cfb1() -> Cipher` [src]

#### `pub fn aes_128_cfb128() -> Cipher` [src]

#### `pub fn aes_128_cfb8() -> Cipher` [src]

#### `pub fn aes_128_gcm() -> Cipher` [src]

#### `pub fn aes_128_ccm() -> Cipher` [src]

#### `pub fn aes_128_ofb() -> Cipher` [src]

#### `pub fn aes_128_ocb() -> Cipher` [src]

Requires OpenSSL 1.1.0 or newer.

#### `pub fn aes_192_ecb() -> Cipher` [src]

#### `pub fn aes_192_cbc() -> Cipher` [src]

#### `pub fn aes_192_ctr() -> Cipher` [src]

#### `pub fn aes_192_cfb1() -> Cipher` [src]

#### `pub fn aes_192_cfb128() -> Cipher` [src]

#### `pub fn aes_192_cfb8() -> Cipher` [src]

#### `pub fn aes_192_gcm() -> Cipher` [src]

#### `pub fn aes_192_ccm() -> Cipher` [src]

#### `pub fn aes_192_ofb() -> Cipher` [src]

#### `pub fn aes_192_ocb() -> Cipher` [src]

Requires OpenSSL 1.1.0 or newer.

#### `pub fn aes_256_ecb() -> Cipher` [src]

#### `pub fn aes_256_cbc() -> Cipher` [src]

#### `pub fn aes_256_xts() -> Cipher` [src]

#### `pub fn aes_256_ctr() -> Cipher` [src]

#### `pub fn aes_256_cfb1() -> Cipher` [src]

#### `pub fn aes_256_cfb128() -> Cipher` [src]

#### `pub fn aes_256_cfb8() -> Cipher` [src]

#### `pub fn aes_256_gcm() -> Cipher` [src]

#### `pub fn aes_256_ccm() -> Cipher` [src]

#### `pub fn aes_256_ofb() -> Cipher` [src]

#### `pub fn aes_256_ocb() -> Cipher` [src]

Requires OpenSSL 1.1.0 or newer.

#### `pub fn bf_cbc() -> Cipher` [src]

#### `pub fn bf_ecb() -> Cipher` [src]

#### `pub fn bf_cfb64() -> Cipher` [src]

#### `pub fn bf_ofb() -> Cipher` [src]

#### `pub fn des_cbc() -> Cipher` [src]

#### `pub fn des_ecb() -> Cipher` [src]

#### `pub fn des_ede3() -> Cipher` [src]

#### `pub fn des_ede3_cbc() -> Cipher` [src]

#### `pub fn des_ede3_cfb64() -> Cipher` [src]

#### `pub fn rc4() -> Cipher` [src]

#### `pub fn chacha20() -> Cipher` [src]

Requires OpenSSL 1.1.0 or newer.

#### `pub fn chacha20_poly1305() -> Cipher` [src]

Requires OpenSSL 1.1.0 or newer.

#### `pub unsafe fn from_ptr(ptr: *const EVP_CIPHER) -> Cipher` [src]

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

# Safety

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

#### `pub fn as_ptr(&self) -> *const EVP_CIPHER` [src]

#### `pub fn key_len(&self) -> usize` [src]

Returns the length of keys used with this cipher.

#### `pub fn iv_len(&self) -> Option<usize>` [src]

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

#### `pub fn block_size(&self) -> usize` [src]

Returns the block size of the cipher.

# Note

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

## Trait Implementations

### `impl Clone for Cipher` [src]

#### `fn clone(&self) -> Cipher` [src]

Returns a copy of the value. Read more

#### `pub fn clone_from(&mut self, source: &Self)`1.0.0 [src]

Performs copy-assignment from `source`. Read more

### `impl Copy for Cipher` [src]

### `impl Eq for Cipher` [src]

### `impl PartialEq<Cipher> for Cipher` [src]

#### `fn eq(&self, other: &Cipher) -> bool` [src]

This method tests for `self` and `other` values to be equal, and is used by `==`. Read more

#### `fn ne(&self, other: &Cipher) -> bool` [src]

This method tests for `!=`.

### `impl Send for Cipher` [src]

### `impl StructuralEq for Cipher` [src]

### `impl StructuralPartialEq for Cipher` [src]

### `impl Sync for Cipher` [src]

## Auto Trait Implementations

### `impl RefUnwindSafe for Cipher`

### `impl Unpin for Cipher`

### `impl UnwindSafe for Cipher`

## Blanket Implementations

### `impl<T> Any for T where
T: 'static + ?Sized,` [src]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T> ToOwned for T where
T: Clone,` [src]

#### `type Owned = T`

The resulting type after obtaining ownership.

#### `pub fn to_owned(&self) -> T` [src]

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

#### `pub fn clone_into(&self, target: &mut T)` [src]

🔬 This is a nightly-only experimental API. (`toowned_clone_into`)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

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

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.