diff options
author | Yakubovsky Dmitriy <[email protected]> | 2018-11-22 22:29:48 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2019-01-16 09:49:19 +0100 |
commit | df051081c6cb1fb8f2e40d53ea9b25e4a14eb5e2 (patch) | |
tree | abdc2b645996db93e486862d3eece47b681bd4d6 /lib | |
parent | 99fbb24b5396749b698474165880f84e3c799b49 (diff) | |
download | otp-df051081c6cb1fb8f2e40d53ea9b25e4a14eb5e2.tar.gz otp-df051081c6cb1fb8f2e40d53ea9b25e4a14eb5e2.tar.bz2 otp-df051081c6cb1fb8f2e40d53ea9b25e4a14eb5e2.zip |
Fix encrypt_config_file and decrypt_config_file
Variable Key is the input parameter and it will never match to the "Key" result of make_crypto_key/1
In current case we'll always receive bad match when using encrypt_config_file and decrypt_config_file functions.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common_test/src/ct_config.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/common_test/src/ct_config.erl b/lib/common_test/src/ct_config.erl index a10d939919..a07e61199b 100644 --- a/lib/common_test/src/ct_config.erl +++ b/lib/common_test/src/ct_config.erl @@ -592,7 +592,7 @@ encrypt_config_file(SrcFileName, EncryptFileName, {file,KeyFile}) -> encrypt_config_file(SrcFileName, EncryptFileName, {key,Key}) -> _ = crypto:start(), - {Key,IVec} = make_crypto_key(Key), + {CryptoKey,IVec} = make_crypto_key(Key), case file:read_file(SrcFileName) of {ok,Bin0} -> Bin1 = term_to_binary({SrcFileName,Bin0}), @@ -600,7 +600,7 @@ encrypt_config_file(SrcFileName, EncryptFileName, {key,Key}) -> 0 -> Bin1; N -> list_to_binary([Bin1,random_bytes(8-N)]) end, - EncBin = crypto:block_encrypt(des3_cbc, Key, IVec, Bin2), + EncBin = crypto:block_encrypt(des3_cbc, CryptoKey, IVec, Bin2), case file:write_file(EncryptFileName, EncBin) of ok -> io:format("~ts --(encrypt)--> ~ts~n", @@ -631,10 +631,10 @@ decrypt_config_file(EncryptFileName, TargetFileName, {file,KeyFile}) -> decrypt_config_file(EncryptFileName, TargetFileName, {key,Key}) -> _ = crypto:start(), - {Key,IVec} = make_crypto_key(Key), + {CryptoKey,IVec} = make_crypto_key(Key), case file:read_file(EncryptFileName) of {ok,Bin} -> - DecBin = crypto:block_decrypt(des3_cbc, Key, IVec, Bin), + DecBin = crypto:block_decrypt(des3_cbc, CryptoKey, IVec, Bin), case catch binary_to_term(DecBin) of {'EXIT',_} -> {error,bad_file}; |