diff options
-rw-r--r-- | lib/public_key/src/pubkey_crypto.erl | 11 | ||||
-rw-r--r-- | lib/public_key/src/public_key.erl | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/public_key/src/pubkey_crypto.erl b/lib/public_key/src/pubkey_crypto.erl index 4ab655e977..7b7abb1c56 100644 --- a/lib/public_key/src/pubkey_crypto.erl +++ b/lib/public_key/src/pubkey_crypto.erl @@ -106,6 +106,11 @@ sign(DigestType, PlainText, #'RSAPrivateKey'{modulus = N, publicExponent = E, crypto:mpint(N), crypto:mpint(D)]); +sign(none, Hash, #'DSAPrivateKey'{p = P, q = Q, g = G, x = X}) -> + crypto:dss_sign(none, Hash, + [crypto:mpint(P), crypto:mpint(Q), + crypto:mpint(G), crypto:mpint(X)]); + sign(sha, PlainText, #'DSAPrivateKey'{p = P, q = Q, g = G, x = X}) -> crypto:dss_sign(sized_binary(PlainText), [crypto:mpint(P), crypto:mpint(Q), @@ -128,6 +133,12 @@ verify(DigestType, PlainText, Signature, sized_binary(Signature), [crypto:mpint(Exp), crypto:mpint(Mod)]); +verify(none, Hash, Signature, Key, #'Dss-Parms'{p = P, q = Q, g = G}) -> + crypto:dss_verify(none, Hash, + sized_binary(Signature), + [crypto:mpint(P), crypto:mpint(Q), + crypto:mpint(G), crypto:mpint(Key)]); + verify(sha, PlainText, Signature, Key, #'Dss-Parms'{p = P, q = Q, g = G}) -> crypto:dss_verify(sized_binary(PlainText), sized_binary(Signature), diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index d1d45f21a0..12354eee5d 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -360,7 +360,9 @@ verify_signature(PlainText, DigestType, Signature, #'RSAPublicKey'{} = Key, pubkey_crypto:verify(DigestType, PlainText, Signature, Key, KeyParams); verify_signature(PlainText, sha, Signature, Key, #'Dss-Parms'{} = KeyParams) when is_binary(PlainText), is_binary(Signature), is_integer(Key) -> - pubkey_crypto:verify(sha, PlainText, Signature, Key, KeyParams). + pubkey_crypto:verify(sha, PlainText, Signature, Key, KeyParams); +verify_signature(Hash, none, Signature, Key, KeyParams) -> + pubkey_crypto:verify(none, Hash, Signature, Key, KeyParams). verify_signature(DerCert, Key, #'Dss-Parms'{} = KeyParams) when is_binary(DerCert), is_integer(Key) -> |