#ansible #crypto

ansible-vault

encrypt and decrypt ansible vault

5 releases

0.2.1 Oct 28, 2022
0.2.0 Mar 10, 2021
0.1.3 Mar 6, 2019
0.1.1 Jan 18, 2019
0.1.0 Jan 18, 2019

#539 in Cryptography

Download history 14/week @ 2022-08-14 14/week @ 2022-08-21 10/week @ 2022-08-28 24/week @ 2022-09-04 16/week @ 2022-09-11 23/week @ 2022-09-18 25/week @ 2022-09-25 22/week @ 2022-10-02 12/week @ 2022-10-09 6/week @ 2022-10-16 37/week @ 2022-10-23 27/week @ 2022-10-30 29/week @ 2022-11-06 21/week @ 2022-11-13 15/week @ 2022-11-20 14/week @ 2022-11-27

79 downloads per month
Used in 2 crates

MIT license

17KB
261 lines

ansible-vault

[dependencies]
ansible-vault = "0.2.1"

Encrypt and decrypt Ansible Vault files

This library provides methods to encrypt and decrypt ansible vault data, in 1.1 format It exposes six methods:

  • encrypt : Encrypt the input to a string without header $ANSIBLE_VAULT;1.1;AES256 nor indentation,
  • encrypt_vault : Encrypt the input, and format like ansible (with header and indentation),
  • encrypt_vault_from_file : Encrypt the given file (wrapper for encrypt_vault)
  • decrypt : Decrypt a message string without header nor indentation
  • decrypt_vault : Decrypt a vault intput (with header and optionally indentation)
  • decrypt_vault_from file : Decrypt an ansible vault from file (wrapper for decrypt_vault)

Usage

Simple usage

use ansible_vault::{encrypt_vault, decrypt_vault};
let lipsum = "Lorem ipsum dolor…";
let encoded = encrypt_vault(lipsum.as_bytes(),"5Up€rs3creT").unwrap();
let decoded = decrypt_vault(encoded.as_bytes(), "5Up€rs3creT").unwrap();
let decoded_str = String::from_utf8(decoded).unwrap();
assert_eq!(lipsum, decoded_str);

License: MIT

Dependencies

~1MB
~18K SLoC