Documentation ¶
Index ¶
- Constants
- Variables
- func MarshallAESKey(aeskey []byte) ([]byte, error)
- func MarshallECKey(eckey *ecdsa.PublicKey) ([]byte, error)
- func UnMarshallAESKey(data []byte) ([]byte, error)
- func UnMarshallECKey(data []byte) (*ecdsa.PublicKey, error)
- type AESKey
- type Encrypt0Message
- type SignMessage
- func (sm *SignMessage) ESSignatureDigests(publicKey *ecdsa.PublicKey, kid []byte) (digests [][]byte, err error)
- func (sm *SignMessage) SignWithESKey(privateKey *ecdsa.PrivateKey, kid []byte) (err error)
- func (sm *SignMessage) UnmarshalCBOR(data []byte) error
- func (sm *SignMessage) VerifyWithESKey(publicKey *ecdsa.PublicKey) (err error)
Constants ¶
View Source
const ( Encrypt0MessageTag = 16 Encrypt0Context = "Encrypt0" )
View Source
const ( KeyTypeECDSA = cose.KeyTypeECDSA KeyTypeSymmetric = 4 AlgorithmAESGCM128 = 1 CurveNISTP521 = 3 )
Variables ¶
View Source
var ( AESGCMNumbers = map[int]int{ 128: coseAlgA128GCM, 192: coseAlgA192GCM, 256: coseAlgA256GCM, } ErrInvalidAESKeyLength = errors.New("invalid key size") ErrUnsupportedAlg = errors.New("unsupported algorithm") )
View Source
var ( ErrUnexpectedKeyType = errors.New("unexpected key type") ErrUnexpectedAlgorithm = errors.New("unexpected algorithm") )
Functions ¶
func MarshallAESKey ¶
func UnMarshallAESKey ¶
Types ¶
type AESKey ¶
type AESKey struct { K []byte `cbor:"-1,keyasint"` // contains filtered or unexported fields }
type Encrypt0Message ¶
Encrypt0Message represents an unencrypted Encrypt0Message.
func Encrypt0MessageFromCBOR ¶
func Encrypt0MessageFromCBOR(marshalled []byte) (message *Encrypt0Message, err error)
func NewEncrypt0Message ¶
func NewEncrypt0Message(payload []byte) (message *Encrypt0Message)
func (*Encrypt0Message) AddKID ¶
func (m *Encrypt0Message) AddKID(kid []byte)
func (*Encrypt0Message) DecodeAESGCMMessage ¶
func (m *Encrypt0Message) DecodeAESGCMMessage(key []byte) (err error)
func (*Encrypt0Message) EncodeAESGCMMessage ¶
func (m *Encrypt0Message) EncodeAESGCMMessage(key []byte) (err error)
func (*Encrypt0Message) MarshalCBOR ¶
func (m *Encrypt0Message) MarshalCBOR() (encoded []byte, err error)
type SignMessage ¶
type SignMessage struct {
*cose.SignMessage
}
func NewSignMessage ¶
func NewSignMessage(payload []byte) (msg *SignMessage)
NewSignMessage creates a basic sign message with a payload.
func SignMessageFromCBOR ¶
func SignMessageFromCBOR(encSignMessage []byte) (m *SignMessage, err error)
SignMessageFromCBOR takes CBOR encoded data and returns a new SignMessage.
func (*SignMessage) ESSignatureDigests ¶ added in v0.2.6
func (sm *SignMessage) ESSignatureDigests(publicKey *ecdsa.PublicKey, kid []byte) (digests [][]byte, err error)
ESSignatureDigests returns the hashed signature digests of the message signatures. We take the public key of the (possibly unknown) private key for the curve params.
func (*SignMessage) SignWithESKey ¶
func (sm *SignMessage) SignWithESKey(privateKey *ecdsa.PrivateKey, kid []byte) (err error)
SignWithESKey adds a signer with kid, and then signs the message with the ECDSA Key.
func (*SignMessage) UnmarshalCBOR ¶ added in v0.2.6
func (sm *SignMessage) UnmarshalCBOR(data []byte) error
func (*SignMessage) VerifyWithESKey ¶
func (sm *SignMessage) VerifyWithESKey(publicKey *ecdsa.PublicKey) (err error)
VerifyWithESKey verifies if the SignMessage has been signed with the given key.
Click to show internal directories.
Click to hide internal directories.