Enum asuran::repository::Encryption [−][src]
Expand description
Tag for the encryption algorthim and IV used by a particular chunk
Variants
Implementations
Creates a new AES256CTR
with a random securely generated IV
Creates a new ChaCha20
with a random securely generated IV
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.
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.
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.
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.
Conviencence function to get a new tag from an old one, specifying the same algorithim, but with a new, securely generated IV
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Encryption, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Encryption, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more