complain more clearly when DSA public keys are read.

This commit is contained in:
Brad Fitzpatrick 2011-01-16 21:05:03 -08:00
parent 5f9840a429
commit 5f82a9caa9
1 changed files with 5 additions and 1 deletions

View File

@ -332,8 +332,12 @@ func readPublicKeyPacket(r io.Reader, length uint16) (pk PublicKeyPacket, err os
pk.PubKeyAlgo = PublicKeyAlgorithm(buf[5])
switch pk.PubKeyAlgo {
case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
// good.
case PubKeyAlgoDSA:
err = error.Unsupported("DSA public key type")
return
default:
err = error.Unsupported("public key type")
err = error.Unsupported(fmt.Sprintf("public key type (%d)", pk.PubKeyAlgo))
return
}