[−][src]Enum asuran_core::repository::encryption::Encryption
Tag for the encryption algorthim and IV used by a particular chunk
Variants
Implementations
impl Encryption[src]
pub fn new_aes256cbc() -> Encryption[src]
Creates an AES256CBC with a random, securely generated IV
pub fn new_aes256ctr() -> Encryption[src]
Creates a new AES256CTR with a random securely generated IV
pub fn new_chacha20() -> Encryption[src]
Creates a new ChaCha20 with a random securely generated IV
pub fn key_length(&self) -> usize[src]
Returns the key length of this encryption method in bytes
NoEncryption has a key length of 16 bytes, as some things rely on a non-zero key
length.
pub fn encrypt(&mut self, data: &[u8], key: &Key) -> Vec<u8>[src]
Encrypts a bytestring using the algrothim specified in the tag, and the given key.
Still requires a key in the event of no encryption, but it does not read this key, so any value can be used. Will pad key with zeros if it is too short
Panics
Will panic if the user selects an encryption algorithm for which support has not been compiled in, or if encryption otherwise fails.
pub fn encrypt_bytes(&mut self, data: &[u8], key: &[u8]) -> Vec<u8>[src]
Internal method that does the actual encryption, please use the encrypt method to avoid key confusion
Panics:
Panics if the user selects an encryption algorithm that support was not compiled in for.
pub fn decrypt(
&self,
data: &[u8],
key: &Key
) -> Result<Vec<u8>, EncryptionError>[src]
&self,
data: &[u8],
key: &Key
) -> Result<Vec<u8>, EncryptionError>
Decrypts a bytestring with the given key
Still requires a key in the event of no encryption, but it does not read this key, so any value can be used. Will pad key with zeros if it is too short.
Errors
Will return Err if decryption fails
Panics
Panics if the user selects an encryption method for which support has not been compiled in.
pub fn decrypt_bytes(
&self,
data: &[u8],
key: &[u8]
) -> Result<Vec<u8>, EncryptionError>[src]
&self,
data: &[u8],
key: &[u8]
) -> Result<Vec<u8>, EncryptionError>
pub fn new_iv(self) -> Encryption[src]
Conviencence function to get a new tag from an old one, specifying the same algorithim, but with a new, securely generated IV
Trait Implementations
impl Clone for Encryption[src]
fn clone(&self) -> Encryption[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for Encryption[src]
impl Debug for Encryption[src]
impl<'de> Deserialize<'de> for Encryption[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl Eq for Encryption[src]
impl Hash for Encryption[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<Encryption> for Encryption[src]
fn eq(&self, other: &Encryption) -> bool[src]
fn ne(&self, other: &Encryption) -> bool[src]
impl Serialize for Encryption[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer, [src]
__S: Serializer,
impl StructuralEq for Encryption[src]
impl StructuralPartialEq for Encryption[src]
Auto Trait Implementations
impl RefUnwindSafe for Encryption
impl Send for Encryption
impl Sync for Encryption
impl Unpin for Encryption
impl UnwindSafe for Encryption
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,