Struct rwarden_crypto::CipherString[][src]

pub struct CipherString {
    pub iv: [u8; 16],
    pub mac: [u8; 32],
    pub ciphertext: Vec<u8>,
}
Expand description

An encrypted string.

Fields

iv: [u8; 16]

The initialization vector.

mac: [u8; 32]

The MAC key.

ciphertext: Vec<u8>

The encrypted data.

Implementations

Parse an encrypted string in the format <ty>.<iv>|<ct>|<mac>.

  • <ty>: The encryption type (currently only type 2 is supported)
  • <iv>: The initialization vector with 16 bytes and encoded as base64
  • <ct>: The ciphertext encoded as base64
  • <mac>: The MAC key with 32 bytes and encoded as base64

Example

use rwarden_crypto::CipherString;

let cipher = CipherString::parse("2.84IzoGc1ydvK9T3MKJD4WQ==|rNZ/2EpbFT4YgQbRcSExgA==|Uy3Zwk0PUNo+rWMZluN83pA8Gm1Ivy3CvO4YvboW8TU=")?;

Encrypt plaintext using the given encryption and MAC key.

Encrypt plaintext using the encryption and MAC key from keys.

Decrypt this encrypted string using the given encryption and MAC key.

Decrypt this encrypted string using the given encryption and MAC key and convert the decrypted data to a String.

Decrypt this encrypted string using the encryption and MAC key from keys.

Decrypt this encrypted string using the encryption and MAC key from keys and convert the decrypted data to a String.

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

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. 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

The type returned in the event of a conversion error.

Performs the conversion.

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

Performs the conversion.

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

Converts the given value to a String. 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.