Function ansible_vault::decrypt[][src]

pub fn decrypt<T: Read>(input: T, key: &str) -> Result<Vec<u8>, VaultError>

Decrypt ansible-vault payload (without header, no indentation nor carriage returns)

Arguments

  • input : a data reader (&u8, file, etc…) to the vault payload
  • key : the key to use decrypt

Example

 let lipsum = "33666638363066623664653234386231616339646438303933633830376132633330353032393364\
               3363373531316565663539326661393165323030383934380a366133633066623963303665303238\
               34633364626339313035633763313034366538363537306265316532663531363632383333353737\
               3863616362363731660a666161623033666331663937626433313432616266393830376431393665\
               3965";
 let decoded = decrypt(lipsum.as_bytes(),"hush").unwrap();
 let decoded_str = String::from_utf8(decoded).unwrap();
 assert_eq!("lipsum", decoded_str);