diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/unit_SUITE.erl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/unit_SUITE.erl b/test/unit_SUITE.erl index 165f0d996b..d9822e7eff 100644 --- a/test/unit_SUITE.erl +++ b/test/unit_SUITE.erl @@ -42,6 +42,7 @@ groups() -> content_framing, content_transcoding, encrypt_decrypt, + encrypt_decrypt_term, pg_local, pmerge, plmerge, @@ -254,6 +255,34 @@ encrypt_decrypt(_Config) -> end || H <- Hashes, C <- Ciphers], ok. +encrypt_decrypt_term(_Config) -> + %% Take all available block ciphers. + Hashes = proplists:get_value(hashs, crypto:supports()) + -- [md4, ripemd160], + Ciphers = proplists:get_value(ciphers, crypto:supports()) + -- [aes_ctr, aes_ecb, des_ecb, blowfish_ecb, rc4, aes_gcm], + %% Different Erlang terms to try encrypting. + DataSet = [ + 10000, + [5672], + [{"127.0.0.1", 5672}, + {"::1", 5672}], + [{connection, info}, {channel, info}], + [{cacertfile, "/path/to/testca/cacert.pem"}, + {certfile, "/path/to/server/cert.pem"}, + {keyfile, "/path/to/server/key.pem"}, + {verify, verify_peer}, + {fail_if_no_peer_cert, false}], + [<<".*">>, <<".*">>, <<".*">>] + ], + _ = [begin + PassPhrase = crypto:strong_rand_bytes(16), + Iterations = rand_compat:uniform(100), + Enc = rabbit_pbe:encrypt_term(C, H, Iterations, PassPhrase, Data), + Data = rabbit_pbe:decrypt_term(C, H, Iterations, PassPhrase, Enc) + end || H <- Hashes, C <- Ciphers, Data <- DataSet], + ok. + %% ------------------------------------------------------------------- %% pg_local. %% ------------------------------------------------------------------- |
