//return a *sm2.PublicKey
return a *sm2.PublicKey
// return a * sm2 . PublicKey
func GetSM2PublicKey(priv bccsp.Key) (*sm2.PublicKey, error) {
	pubKey, err := priv.PublicKey()
	if err != nil {
		return nil, err
	}
	pubKeyBytes, err := pubKey.Bytes()
	if err != nil {
		return nil, err
	}
	pub, err := utils.DERToPublicKey(pubKeyBytes)
	if err != nil {
		return nil, err
	}
	switch pub.(type) {
	case *sm2.PublicKey:
		fmt.Println("GetPublicKey returns a *sm2.PublicKey")
		return pub.(*sm2.PublicKey), nil
	case *ecdsa.PublicKey:
		fmt.Println("GetPublicKey returns a *ecdsa.PublicKey")
		return nil, errors.New("FAIL, Expected sm2.PublicKey, got ecdsa.PublicKey")
	}
	return nil, errors.New("Fail, Not a SM2 PublicKey")
}
func GetSM2PublicKey ( priv bccsp . Key ) ( * sm2 . PublicKey , error ) { pubKey , err := priv . PublicKey ( ) if err != nil { return nil , err } pubKeyBytes , err := pubKey . Bytes ( ) if err != nil { return nil , err } pub , err := utils . DERToPublicKey ( pubKeyBytes ) if err != nil { return nil , err } switch pub . ( type ) { case * sm2 . PublicKey : fmt . Println ( " " ) return pub . ( * sm2 . PublicKey ) , nil case * ecdsa . PublicKey : fmt . Println ( " " ) return nil , errors . New ( " " ) } return nil , errors . New ( " " ) }
return a *sm2.PublicKey
return a * sm2 . PublicKey
//sm2PubKey, err := sm2.ParseSm2PublicKey(pubKeyBytes) //return pub.(*ecdsa.PublicKey), nil