From: Grégory Burri Date: Wed, 7 Aug 2019 12:51:40 +0000 (+0200) Subject: Cleaning+comments. X-Git-Url: https://git.euphorik.ch/?a=commitdiff_plain;h=0584cc756079ea4a4f337269fbfbd705fa4e2d48;p=rup.git Cleaning+comments. --- diff --git a/README.md b/README.md index 4308f25..c50b374 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ * PS> cd vcpkg * PS> .\bootstrap-vcpkg.bat * Install openssl dev livb - * PS> vcpkg install openssl:x64-windows + * PS> .\vcpkg.exe install openssl:x64-windows * Define these env variables: * $env:VCPKG_ROOT= * $env:OPENSSL_DIR=\installed\x64-windows diff --git a/src/crypto.rs b/src/crypto.rs index 7e707d0..f415fa1 100644 --- a/src/crypto.rs +++ b/src/crypto.rs @@ -33,8 +33,7 @@ fn decode_key(key: &str) -> Result, KeyError> { } /// Encrypt the given text with the given key. The key length must be 128 bits encoded in base64. -/// Ouput format: -/// Format "1" + base_64( + + ) +/// Ouput format: "1" + base_64( + + ) /// IV: 16 bytes randomized. /// Mode : CBC. pub fn encrypt(key: &str, plain_text: &str) -> Result { @@ -59,7 +58,8 @@ pub fn encrypt(key: &str, plain_text: &str) -> Result { Ok(String::from("1") + &base64::encode(&result)) } -/// TODO: return a Result +/// Decrypt the given text with the given key. The key length must be 128 bits encoded in base64. +/// Input format: "1" + base_64( + + ) pub fn decrypt(key: &str, cipher_text: &str) -> Result { let key_as_bytes = decode_key(key).map_err(|e| DecryptError::KeyError(e))?;