diff options
author | Ingela Anderton Andin <[email protected]> | 2017-11-10 14:49:19 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2017-11-10 14:49:19 +0100 |
commit | 44072a52acfe5df18ca22e1c9408770532c1af15 (patch) | |
tree | a395ea8cc03496ffdbf019ae253de2ffa47dade9 /lib/ssl/src/ssl_handshake.erl | |
parent | 3d0f90bfea2c64c7809c036fb2d569f04aad95e3 (diff) | |
parent | e21f3eb30a384fab1db839ac6a21a6f2055cfb6f (diff) | |
download | otp-44072a52acfe5df18ca22e1c9408770532c1af15.tar.gz otp-44072a52acfe5df18ca22e1c9408770532c1af15.tar.bz2 otp-44072a52acfe5df18ca22e1c9408770532c1af15.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/ssl/src/ssl_handshake.erl')
-rw-r--r-- | lib/ssl/src/ssl_handshake.erl | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl index 81d38a38e4..8681765284 100644 --- a/lib/ssl/src/ssl_handshake.erl +++ b/lib/ssl/src/ssl_handshake.erl @@ -1702,14 +1702,20 @@ digitally_signed(Version, Hashes, HashAlgo, PrivateKey) -> error:badkey-> throw(?ALERT_REC(?FATAL, ?HANDSHAKE_FAILURE, bad_key(PrivateKey))) end. - +do_digitally_signed({3, Minor}, Hash, HashAlgo, #{algorithm := Alg} = Engine) + when Minor >= 3 -> + crypto:sign(Alg, HashAlgo, {digest, Hash}, maps:remove(algorithm, Engine)); do_digitally_signed({3, Minor}, Hash, HashAlgo, Key) when Minor >= 3 -> public_key:sign({digest, Hash}, HashAlgo, Key); -do_digitally_signed(_Version, Hash, HashAlgo, #'DSAPrivateKey'{} = Key) -> - public_key:sign({digest, Hash}, HashAlgo, Key); do_digitally_signed(_Version, Hash, _HashAlgo, #'RSAPrivateKey'{} = Key) -> public_key:encrypt_private(Hash, Key, [{rsa_pad, rsa_pkcs1_padding}]); +do_digitally_signed({3, _}, Hash, _, + #{algorithm := rsa} = Engine) -> + crypto:private_encrypt(rsa, Hash, maps:remove(algorithm, Engine), + rsa_pkcs1_padding); +do_digitally_signed({3, _}, Hash, HashAlgo, #{algorithm := Alg} = Engine) -> + crypto:sign(Alg, HashAlgo, {digest, Hash}, maps:remove(algorithm, Engine)); do_digitally_signed(_Version, Hash, HashAlgo, Key) -> public_key:sign({digest, Hash}, HashAlgo, Key). |