Function sjcl::decrypt[][src]

pub fn decrypt(chunk: SjclBlockJson, key: String) -> Result<Vec<u8>, SjclError>

Decrypts a chunk of SJCL encrypted JSON with a given passphrase.

let data = SjclBlockJson {
  iv: "aDvOWpwgcF0S7YDvu3TrTQ==".to_string(),
  v: 1,
  iter: 1000,
  ks: 128,
  ts: 64,
  mode: "ccm".to_string(),
  adata: "".to_string(),
  cipher: "aes".to_string(),
  salt: "qpVeWJh4g1I=".to_string(),
  ct: "3F6gxac5V5k39iUNHubqEOHrxuZJqoX2zyws9nU=".to_string(),
};
let plaintext = decrypt(data, "abcdefghi".to_string());
assert_eq!("but dogs are the best".to_string(), plaintext);