Struct rwarden_crypto::CipherString [−][src]
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 type2
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
fn deserialize<D>(deserializer: D) -> Result<CipherString, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<CipherString, D::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 !=
.
Auto Trait Implementations
impl RefUnwindSafe for CipherString
impl Send for CipherString
impl Sync for CipherString
impl Unpin for CipherString
impl UnwindSafe for CipherString
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self