Enum asuran::repository::Encryption[][src]

pub enum Encryption {
    NoEncryption,
    AES256CTR {
        iv: [u8; 16],
    },
    ChaCha20 {
        iv: [u8; 12],
    },
}
Expand description

Tag for the encryption algorthim and IV used by a particular chunk

Variants

NoEncryption
AES256CTR

Fields of AES256CTR

iv: [u8; 16]
ChaCha20

Fields of ChaCha20

iv: [u8; 12]

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

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

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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