diff options
| author | Loïc Hoguin <essen@ninenines.eu> | 2016-09-29 17:53:28 +0200 |
|---|---|---|
| committer | Loïc Hoguin <essen@ninenines.eu> | 2016-09-29 17:53:28 +0200 |
| commit | 8edcd88d01b5e3cef565219272d48e5f01d4e969 (patch) | |
| tree | 4bd566013fb3c2f5e2b8eca95a0bf4c26e2c50e7 /src | |
| parent | 7cb692ea9f4b4ae871e9eb31aa67367f30b976f1 (diff) | |
| download | rabbitmq-server-git-8edcd88d01b5e3cef565219272d48e5f01d4e969.tar.gz | |
Add rabbit_pbe:encrypt_term and decrypt_term
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_pbe.erl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rabbit_pbe.erl b/src/rabbit_pbe.erl index 2671493983..5773faf9dc 100644 --- a/src/rabbit_pbe.erl +++ b/src/rabbit_pbe.erl @@ -16,8 +16,17 @@ -module(rabbit_pbe). +-export([encrypt_term/5, decrypt_term/5]). -export([encrypt/5, decrypt/5]). +%% Encryption/decryption of arbitrary Erlang terms. + +encrypt_term(Cipher, Hash, Iterations, PassPhrase, Term) -> + encrypt(Cipher, Hash, Iterations, PassPhrase, term_to_binary(Term)). + +decrypt_term(Cipher, Hash, Iterations, PassPhrase, Base64Binary) -> + binary_to_term(decrypt(Cipher, Hash, Iterations, PassPhrase, Base64Binary)). + %% The cipher for encryption is from the list of supported ciphers. %% The hash for generating the key from the passphrase is from the list %% of supported hashes. See crypto:supports/0 to obtain both lists. |
