// TestKeyRequest ensures that key generation returns the same type of
// key specified in the KeyRequest.
TestKeyRequest ensures that key generation returns the same type of
key specified in the KeyRequest.
// TestKeyRequest ensures that key generation returns the same type of // key specified in the KeyRequest .
func TestKeyRequest(t *testing.T) {
	kr := NewKeyRequest()
	priv, err := kr.Generate()
	if err != nil {
		t.Fatalf("%v", err)
	}
	switch priv.(type) {
	case *rsa.PrivateKey:
		if kr.Algo() != "rsa" {
			t.Fatal("RSA key generated, but expected", kr.Algo())
		}
	case *ecdsa.PrivateKey:
		if kr.Algo() != "ecdsa" {
			t.Fatal("ECDSA key generated, but expected", kr.Algo())
		}
	}
}
func TestKeyRequest ( t * testing . T ) { kr := NewKeyRequest ( ) priv , err := kr . Generate ( ) if err != nil { t . Fatalf ( " " , err ) } switch priv . ( type ) { case * rsa . PrivateKey : if kr . Algo ( ) != " " { t . Fatal ( " " , kr . Algo ( ) ) } case * ecdsa . PrivateKey : if kr . Algo ( ) != " " { t . Fatal ( " " , kr . Algo ( ) ) } } }
TestKeyRequest ensures that key generation returns the same type of
key specified in the KeyRequest.
TestKeyRequest ensures that key generation returns the same type of key specified in the KeyRequest .