Crate sjcl[][src]

sjcl

Simple decrypt-only SJCL library.

Only supports AES-CCM so far, but OCB2 is deprecated AFAIK. To use you only need the result of a SJCL encrypted secret and the passphrase.

Usage

Decrypt a file loaded into a string:

use sjcl::{decrypt_raw, SjclError};
 
let data = "{\"iv\":\"nJu7KZF2eEqMv403U2oc3w==\", \"v\":1, \"iter\":10000, \"ks\":256, \"ts\":64, \"mode\":\"ccm\", \"adata\":\"\", \"cipher\":\"aes\", \"salt\":\"mMmxX6SipEM=\", \"ct\":\"VwnKwpW1ah5HmdvwuFBthx0=\"}".to_string();
let password_phrase = "abcdefghi".to_string();
let plaintext = decrypt_raw(data, password_phrase)?;
assert_eq!("test\ntest".to_string(), String::from_utf8(plaintext).unwrap());

Structs

SjclBlockJson

Deserialized block generated by SJCL.

Enums

SjclError

Functions

decrypt

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

decrypt_raw

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