pub fn json_decrypt(ciphertext: String) -> String {
    // Split ciphertext to three sections
    let v: Vec<&str> = ciphertext.split('$').collect();
    // Derived password is in first section
    let derived_password = derive_password(v[0].to_string());
    // Second section contains IV
    let decoded_iv: Vec<u8> = base64::decode(v[1]).unwrap();
    // Third section contains encrypted text
    let encrypted_text = base64::decode(v[2]).unwrap();
    // Decrypt
    let plaintext = aes_256_gcm_siv_decrypt(derived_password, decoded_iv, encrypted_text);
    // Return decrypted text
    return str::from_utf8(&plaintext).unwrap().to_string();
}
// Decrypt function wrapper for JSON Backend
Decrypt function wrapper for JSON Backend
Decrypt function wrapper for JSON Backend
pub fn json_decrypt(ciphertext: String) -> String {
    // Split ciphertext to three sections
    let v: Vec<&str> = ciphertext.split('$').collect();
    // Derived password is in first section
    let derived_password = derive_password(v[0].to_string());
    // Second section contains IV
    let decoded_iv: Vec<u8> = base64::decode(v[1]).unwrap();
    // Third section contains encrypted text
    let encrypted_text = base64::decode(v[2]).unwrap();
    // Decrypt
    let plaintext = aes_256_gcm_siv_decrypt(derived_password, decoded_iv, encrypted_text);
    // Return decrypted text
    return str::from_utf8(&plaintext).unwrap().to_string();
}
pub fn json_decrypt ( ciphertext : String ) -> String { // Split ciphertext to three sections let v : Vec < & str > = ciphertext . split ( '$' ) . collect ( ) ; // Derived password is in first section let derived_password = derive_password ( v [ 0 ] . to_string ( ) ) ; // Second section contains IV let decoded_iv : Vec < u8 > = base64 :: decode ( v [ 1 ] ) . unwrap ( ) ; // Third section contains encrypted text let encrypted_text = base64 :: decode ( v [ 2 ] ) . unwrap ( ) ; // Decrypt let plaintext = aes_256_gcm_siv_decrypt ( derived_password , decoded_iv , encrypted_text ) ; // Return decrypted text return str :: from_utf8 ( & plaintext ) . unwrap ( ) . to_string ( ) ; }
Decrypt function wrapper for JSON Backend
Decrypt function wrapper for JSON Backend
ciphertext
String
ciphertext
String