func UnmarshalPublicKey(raw []byte) (key PublicKey, remaining []byte, err error) {
	var base publicKeyStructure
	err = cbor.Unmarshal(raw, &base)
	if err != nil {
		return nil, nil, fmt.Errorf("%w: %s", ErrInvalidPublicKey, err)
	}

	switch base.Type {
	case KeyTypeElliptic:
		return UnmarshalECDSAPublicKey(raw)
	case KeyTypeOctet:
		return UnmarshalEdDSAPublicKey(raw)
	case KeyTypeRSA:
		return UnmarshalRSAPublicKey(raw)
	}
	return nil, nil, fmt.Errorf("%w: %d", ErrUnsupportedKeyType, base.Type)
}
// UnmarshalPublicKey unmarshals a COSE_Key encoded public key from a slice of bytes.
UnmarshalPublicKey unmarshals a COSE_Key encoded public key from a slice of bytes.
// UnmarshalPublicKey unmarshals a COSE_Key encoded public key from a slice of bytes .
func UnmarshalPublicKey(raw []byte) (key PublicKey, remaining []byte, err error) {
	var base publicKeyStructure
	err = cbor.Unmarshal(raw, &base)
	if err != nil {
		return nil, nil, fmt.Errorf("%w: %s", ErrInvalidPublicKey, err)
	}
	switch base.Type {
	case KeyTypeElliptic:
		return UnmarshalECDSAPublicKey(raw)
	case KeyTypeOctet:
		return UnmarshalEdDSAPublicKey(raw)
	case KeyTypeRSA:
		return UnmarshalRSAPublicKey(raw)
	}
	return nil, nil, fmt.Errorf("%w: %d", ErrUnsupportedKeyType, base.Type)
}
func UnmarshalPublicKey ( raw [ ] byte ) ( key PublicKey , remaining [ ] byte , err error ) { var base publicKeyStructure err = cbor . Unmarshal ( raw , & base ) if err != nil { return nil , nil , fmt . Errorf ( " " , ErrInvalidPublicKey , err ) } switch base . Type { case KeyTypeElliptic : return UnmarshalECDSAPublicKey ( raw ) case KeyTypeOctet : return UnmarshalEdDSAPublicKey ( raw ) case KeyTypeRSA : return UnmarshalRSAPublicKey ( raw ) } return nil , nil , fmt . Errorf ( " " , ErrUnsupportedKeyType , base . Type ) }
UnmarshalPublicKey unmarshals a COSE_Key encoded public key from a slice of bytes.
UnmarshalPublicKey unmarshals a COSE_Key encoded public key from a slice of bytes .