Expand description
§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_json;
use sjcl::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_json(data, password_phrase, None)?;
assert_eq!("test\ntest".to_string(), String::from_utf8(plaintext).unwrap());
Re-exports§
pub use decryption::decrypt;
pub use decryption::decrypt_json;
pub use encryption::encrypt;
Modules§
Structs§
- Sjcl
Block - SJCL result contains all params as well as either the plaintext or the ciphertext in the last element.
- Sjcl
Params - Parameter used to encrypt a block.
Enums§
Functions§
- truncate_
iv - Utility function to trim the initialization vector to the proper size of the nonce. (See: SJCL/core.ccm.js)