Skip to content

Commit

Permalink
badkeys: add dsa.PublicKey
Browse files Browse the repository at this point in the history
  • Loading branch information
hdm committed Dec 8, 2024
1 parent 54f5d30 commit ab42e71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion badkeys/badkeys.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package badkeys

import (
"crypto/dsa"
"encoding/json"
"fmt"
"io"
Expand Down Expand Up @@ -29,14 +30,16 @@ 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:
rawb = pub
case x509.X25519PublicKey:
rawb = pub
case *ecdh.PublicKey:
rawb = pub.Bytes()
rawb = pub.Bytes() // Verify
default:
return nil, fmt.Errorf("unsupported key: %T", pub)
}
Expand Down

0 comments on commit ab42e71

Please sign in to comment.