Function sjcl::decryption::decrypt [−][src]
pub fn decrypt(
chunk: SjclBlock,
key: String,
adata: Option<String>
) -> Result<Vec<u8>, SjclError>
Expand description
Decrypts a chunk of SJCL encrypted JSON with a given passphrase.
let data = sjcl::SjclBlock::new( "aDvOWpwgcF0S7YDvu3TrTQ==".to_string(), 1, 1000, 128, 64, "ccm".to_string(), "".to_string(), "aes".to_string(), "qpVeWJh4g1I=".to_string(), "3F6gxac5V5k39iUNHubqEOHrxuZJqoX2zyws9nU=".to_string(), ); let plaintext = sjcl::decrypt(data, "abcdefghi".to_string(), None).unwrap(); assert_eq!("but dogs are the best".to_string(), String::from_utf8(plaintext).unwrap());