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
impl Cipher
sourcepub fn from_nid(nid: Nid) -> Option<Cipher>
pub fn from_nid(nid: Nid) -> Option<Cipher>
Looks up the cipher for a certain nid.
This corresponds to EVP_get_cipherbynid
.
sourcepub fn nid(&self) -> Nid
pub fn nid(&self) -> Nid
Returns the cipher’s Nid.
This corresponds to EVP_CIPHER_nid
.
pub fn aes_128_ecb() -> Cipher
pub fn aes_128_cbc() -> Cipher
pub fn aes_128_xts() -> Cipher
pub fn aes_128_ctr() -> Cipher
pub fn aes_128_cfb1() -> Cipher
pub fn aes_128_cfb128() -> Cipher
pub fn aes_128_cfb8() -> Cipher
pub fn aes_128_gcm() -> Cipher
pub fn aes_128_ccm() -> Cipher
pub fn aes_128_ofb() -> Cipher
sourcepub fn aes_128_ocb() -> Cipher
pub fn aes_128_ocb() -> Cipher
Requires OpenSSL 1.1.0 or newer.
pub fn aes_192_ecb() -> Cipher
pub fn aes_192_cbc() -> Cipher
pub fn aes_192_ctr() -> Cipher
pub fn aes_192_cfb1() -> Cipher
pub fn aes_192_cfb128() -> Cipher
pub fn aes_192_cfb8() -> Cipher
pub fn aes_192_gcm() -> Cipher
pub fn aes_192_ccm() -> Cipher
pub fn aes_192_ofb() -> Cipher
sourcepub fn aes_192_ocb() -> Cipher
pub fn aes_192_ocb() -> Cipher
Requires OpenSSL 1.1.0 or newer.
pub fn aes_256_ecb() -> Cipher
pub fn aes_256_cbc() -> Cipher
pub fn aes_256_xts() -> Cipher
pub fn aes_256_ctr() -> Cipher
pub fn aes_256_cfb1() -> Cipher
pub fn aes_256_cfb128() -> Cipher
pub fn aes_256_cfb8() -> Cipher
pub fn aes_256_gcm() -> Cipher
pub fn aes_256_ccm() -> Cipher
pub fn aes_256_ofb() -> Cipher
sourcepub fn aes_256_ocb() -> Cipher
pub fn aes_256_ocb() -> Cipher
Requires OpenSSL 1.1.0 or newer.
pub fn bf_cbc() -> Cipher
pub fn bf_ecb() -> Cipher
pub fn bf_cfb64() -> Cipher
pub fn bf_ofb() -> Cipher
pub fn des_cbc() -> Cipher
pub fn des_ecb() -> Cipher
pub fn des_ede3() -> Cipher
pub fn des_ede3_cbc() -> Cipher
pub fn des_ede3_ecb() -> Cipher
pub fn des_ede3_cfb64() -> Cipher
pub fn des_ede3_cfb8() -> Cipher
pub fn des_ede3_ofb() -> Cipher
pub fn rc4() -> Cipher
pub fn camellia_128_cbc() -> Cipher
pub fn camellia_128_ecb() -> Cipher
pub fn camellia_128_ofb() -> Cipher
pub fn camellia_128_cfb128() -> Cipher
pub fn camellia_192_cbc() -> Cipher
pub fn camellia_192_ecb() -> Cipher
pub fn camellia_192_ofb() -> Cipher
pub fn camellia_192_cfb128() -> Cipher
pub fn camellia_256_cbc() -> Cipher
pub fn camellia_256_ecb() -> Cipher
pub fn camellia_256_ofb() -> Cipher
pub fn camellia_256_cfb128() -> Cipher
pub fn cast5_cbc() -> Cipher
pub fn cast5_ecb() -> Cipher
pub fn cast5_ofb() -> Cipher
pub fn cast5_cfb64() -> Cipher
sourcepub fn chacha20_poly1305() -> Cipher
pub fn chacha20_poly1305() -> Cipher
Requires OpenSSL 1.1.0 or newer.
pub fn seed_cbc() -> Cipher
pub fn seed_cfb128() -> Cipher
pub fn seed_ecb() -> Cipher
pub fn seed_ofb() -> Cipher
pub fn sm4_ecb() -> Cipher
pub fn sm4_cbc() -> Cipher
pub fn sm4_ctr() -> Cipher
pub fn sm4_cfb128() -> Cipher
pub fn sm4_ofb() -> Cipher
sourcepub unsafe fn from_ptr(ptr: *const EVP_CIPHER) -> Cipher
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.
pub fn as_ptr(&self) -> *const EVP_CIPHER
sourcepub fn iv_len(&self) -> Option<usize>
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.
sourcepub fn block_size(&self) -> usize
pub fn block_size(&self) -> usize
Trait Implementations§
source§impl PartialEq for Cipher
impl PartialEq for Cipher
impl Copy for Cipher
impl Eq for Cipher
impl Send for Cipher
impl StructuralPartialEq for Cipher
impl Sync for Cipher
Auto Trait Implementations§
impl Freeze for Cipher
impl RefUnwindSafe for Cipher
impl Unpin for Cipher
impl UnwindSafe for Cipher
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)