summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_pbe.erl9
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.