// TestECGeneration ensures that the proper curve is used depending on
// the bit size specified in a key request and that an appropriate
// signature algorithm is returned.
TestECGeneration ensures that the proper curve is used depending on
the bit size specified in a key request and that an appropriate
signature algorithm is returned.
// TestECGeneration ensures that the proper curve is used depending on // the bit size specified in a key request and that an appropriate // signature algorithm is returned .
func TestECGeneration(t *testing.T) {
	var eckey *ecdsa.PrivateKey
	for _, sz := range []int{256, 384, 521} {
		kr := &KeyRequest{"ecdsa", sz}
		priv, err := kr.Generate()
		if err != nil {
			t.Fatalf("%v", err)
		}
		eckey = priv.(*ecdsa.PrivateKey)
		if eckey.Curve != whichCurve(sz) {
			t.Fatal("Generated key has wrong curve.")
		}
		if sa := kr.SigAlgo(); sa == x509.UnknownSignatureAlgorithm {
			t.Fatal("Invalid signature algorithm!")
		}
	}
}
func TestECGeneration ( t * testing . T ) { var eckey * ecdsa . PrivateKey for _ , sz := range [ ] int { 256 , 384 , 521 } { kr := & KeyRequest { " " , sz } priv , err := kr . Generate ( ) if err != nil { t . Fatalf ( " " , err ) } eckey = priv . ( * ecdsa . PrivateKey ) if eckey . Curve != whichCurve ( sz ) { t . Fatal ( " " ) } if sa := kr . SigAlgo ( ) ; sa == x509 . UnknownSignatureAlgorithm { t . Fatal ( " " ) } } }
TestECGeneration ensures that the proper curve is used depending on
the bit size specified in a key request and that an appropriate
signature algorithm is returned.
TestECGeneration ensures that the proper curve is used depending on the bit size specified in a key request and that an appropriate signature algorithm is returned .