From ab42e71c4c9ceba8e124b022d7fe359a0de3a7b7 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Sun, 8 Dec 2024 17:31:02 -0600 Subject: [PATCH] badkeys: add dsa.PublicKey --- badkeys/badkeys.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/badkeys/badkeys.go b/badkeys/badkeys.go index 3e8066c..2e6a9a1 100644 --- a/badkeys/badkeys.go +++ b/badkeys/badkeys.go @@ -1,6 +1,7 @@ package badkeys import ( + "crypto/dsa" "encoding/json" "fmt" "io" @@ -29,6 +30,8 @@ func PrefixFromPublicKey(pub any) ([]byte, error) { return nil, fmt.Errorf("unsupported ssh public key: %v", pub.Type()) case *rsa.PublicKey: rawb = pub.N.Bytes() + case *dsa.PublicKey: + rawb = pub.Y.Bytes() case *ecdsa.PublicKey: rawb = pub.X.Bytes() case ed25519.PublicKey: @@ -36,7 +39,7 @@ func PrefixFromPublicKey(pub any) ([]byte, error) { case x509.X25519PublicKey: rawb = pub case *ecdh.PublicKey: - rawb = pub.Bytes() + rawb = pub.Bytes() // Verify default: return nil, fmt.Errorf("unsupported key: %T", pub) }