func UnmarshalRSAPublicKey(raw []byte) (key *RSAPublicKey, remaining []byte, err error) {
	var obj publicKeyStructureRSA
	decoder := cbor.NewDecoder(bytes.NewReader(raw))
	err = decoder.Decode(&obj)
	if err != nil {
		return nil, nil, ErrInvalidPublicKey
	}

	switch obj.Type {
	case KeyTypeRSA:
	default:
		return nil, nil, fmt.Errorf("%w: %v", ErrUnsupportedKeyType, obj.Type)
	}

	publicKey := rsa.PublicKey{
		// All numbers are stored as unsigned, big-endian integers. This is the same format
		// as big.Int.
		N: big.NewInt(0).SetBytes(obj.Modulus),
		E: int(big.NewInt(0).SetBytes(obj.Exponent).Int64()),
	}

	key, err = NewRSAPublicKey(obj.Algorithm, publicKey)
	if err != nil {
		return nil, nil, err
	}
	remaining = raw[decoder.NumBytesRead():]
	err = nil
	return key, remaining, err
}
// UnmarshalRSAPublicKey unmarshals an RSA key using the COSE_Key format.
UnmarshalRSAPublicKey unmarshals an RSA key using the COSE_Key format.
// UnmarshalRSAPublicKey unmarshals an RSA key using the COSE_Key format .
func UnmarshalRSAPublicKey(raw []byte) (key *RSAPublicKey, remaining []byte, err error) {
	var obj publicKeyStructureRSA
	decoder := cbor.NewDecoder(bytes.NewReader(raw))
	err = decoder.Decode(&obj)
	if err != nil {
		return nil, nil, ErrInvalidPublicKey
	}
	switch obj.Type {
	case KeyTypeRSA:
	default:
		return nil, nil, fmt.Errorf("%w: %v", ErrUnsupportedKeyType, obj.Type)
	}
	publicKey := rsa.PublicKey{
		N: big.NewInt(0).SetBytes(obj.Modulus),
		E: int(big.NewInt(0).SetBytes(obj.Exponent).Int64()),
	}
	key, err = NewRSAPublicKey(obj.Algorithm, publicKey)
	if err != nil {
		return nil, nil, err
	}
	remaining = raw[decoder.NumBytesRead():]
	err = nil
	return key, remaining, err
}
func UnmarshalRSAPublicKey ( raw [ ] byte ) ( key * RSAPublicKey , remaining [ ] byte , err error ) { var obj publicKeyStructureRSA decoder := cbor . NewDecoder ( bytes . NewReader ( raw ) ) err = decoder . Decode ( & obj ) if err != nil { return nil , nil , ErrInvalidPublicKey } switch obj . Type { case KeyTypeRSA : default : return nil , nil , fmt . Errorf ( " " , ErrUnsupportedKeyType , obj . Type ) } publicKey := rsa . PublicKey { N : big . NewInt ( 0 ) . SetBytes ( obj . Modulus ) , E : int ( big . NewInt ( 0 ) . SetBytes ( obj . Exponent ) . Int64 ( ) ) , } key , err = NewRSAPublicKey ( obj . Algorithm , publicKey ) if err != nil { return nil , nil , err } remaining = raw [ decoder . NumBytesRead ( ) : ] err = nil return key , remaining , err }
UnmarshalRSAPublicKey unmarshals an RSA key using the COSE_Key format.
UnmarshalRSAPublicKey unmarshals an RSA key using the COSE_Key format .
// All numbers are stored as unsigned, big-endian integers. This is the same format // as big.Int.