Versions in this module Expand all Collapse all v1 v1.2.1 Jul 4, 2023retracted v1.2.0 Jun 29, 2023retracted Changes in this version + var ErrInvalidPrivKey = errors.New("invalid private key") + var ErrNotPrivKey = errors.New("not a private key") + var ErrSignOpNotSupported = errors.New("sign key_op not supported by key") + var ErrVerifyOpNotSupported = errors.New("verify key_op not supported by key") type Algorithm + const AlgorithmInvalid + func (a *Algorithm) UnmarshalCBOR(data []byte) error + func (a Algorithm) MarshalCBOR() ([]byte, error) + type Curve int64 + const CurveEd25519 + const CurveEd448 + const CurveInvalid + const CurveP256 + const CurveP384 + const CurveP521 + const CurveX25519 + const CurveX448 + func (c *Curve) UnmarshalCBOR(data []byte) error + func (c Curve) MarshalCBOR() ([]byte, error) + func (c Curve) String() string + type Key struct + Algorithm Algorithm + BaseIV []byte + Curve Curve + D []byte + K []byte + KeyID []byte + KeyOps []KeyOp + KeyType KeyType + X []byte + Y []byte + func NewEC2Key(alg Algorithm, x, y, d []byte) (*Key, error) + func NewKeyFromPrivate(alg Algorithm, priv crypto.PrivateKey) (*Key, error) + func NewKeyFromPublic(alg Algorithm, pub crypto.PublicKey) (*Key, error) + func NewOKPKey(alg Algorithm, x, d []byte) (*Key, error) + func NewSymmetricKey(k []byte) (*Key, error) + func (k *Key) AlgorithmOrDefault() (Algorithm, error) + func (k *Key) MarshalCBOR() ([]byte, error) + func (k *Key) PrivateKey() (crypto.PrivateKey, error) + func (k *Key) PublicKey() (crypto.PublicKey, error) + func (k *Key) Signer() (Signer, error) + func (k *Key) UnmarshalCBOR(data []byte) error + func (k *Key) Verifier() (Verifier, error) + func (k Key) Validate() error + type KeyOp int64 + const KeyOpDecrypt + const KeyOpDeriveBits + const KeyOpDeriveKey + const KeyOpEncrypt + const KeyOpInvalid + const KeyOpMACCreate + const KeyOpMACVerify + const KeyOpSign + const KeyOpUnwrapKey + const KeyOpVerify + const KeyOpWrapKey + func KeyOpFromString(val string) (KeyOp, error) + func (ko *KeyOp) UnmarshalCBOR(data []byte) error + func (ko KeyOp) IsSupported() bool + func (ko KeyOp) MarshalCBOR() ([]byte, error) + func (ko KeyOp) String() string + type KeyType int64 + const KeyTypeEC2 + const KeyTypeInvalid + const KeyTypeOKP + const KeyTypeSymmetric + func (kt *KeyType) UnmarshalCBOR(data []byte) error + func (kt KeyType) MarshalCBOR() ([]byte, error) + func (kt KeyType) String() string v1.1.0 May 18, 2023 Changes in this version + var ErrInvalidPubKey = errors.New("invalid public key") + func Sign1Untagged(rand io.Reader, signer Signer, headers Headers, payload []byte, ...) ([]byte, error) + type UntaggedSign1Message Sign1Message + func (m *UntaggedSign1Message) MarshalCBOR() ([]byte, error) + func (m *UntaggedSign1Message) Sign(rand io.Reader, external []byte, signer Signer) error + func (m *UntaggedSign1Message) UnmarshalCBOR(data []byte) error + func (m *UntaggedSign1Message) Verify(external []byte, verifier Verifier) error v1.0.0 Dec 12, 2022 Changes in this version + const CBORTagSign1Message + const CBORTagSignMessage + const HeaderLabelAlgorithm + const HeaderLabelContentType + const HeaderLabelCounterSignature + const HeaderLabelCounterSignature0 + const HeaderLabelCritical + const HeaderLabelIV + const HeaderLabelKeyID + const HeaderLabelPartialIV + const HeaderLabelX5Bag + const HeaderLabelX5Chain + const HeaderLabelX5T + const HeaderLabelX5U + var ErrAlgorithmMismatch = errors.New("algorithm mismatch") + var ErrAlgorithmNotFound = errors.New("algorithm not found") + var ErrAlgorithmNotSupported = errors.New("algorithm not supported") + var ErrEmptySignature = errors.New("empty signature") + var ErrInvalidAlgorithm = errors.New("invalid algorithm") + var ErrMissingPayload = errors.New("missing payload") + var ErrNoSignatures = errors.New("no signatures attached") + var ErrUnavailableHashFunc = errors.New("hash function is not available") + var ErrVerification = errors.New("verification error") + func I2OSP(x *big.Int, buf []byte) error + func OS2IP(x []byte) *big.Int + func Sign1(rand io.Reader, signer Signer, headers Headers, payload []byte, ...) ([]byte, error) + type Algorithm int64 + const AlgorithmES256 + const AlgorithmES384 + const AlgorithmES512 + const AlgorithmEd25519 + const AlgorithmPS256 + const AlgorithmPS384 + const AlgorithmPS512 + func (a Algorithm) String() string + type Headers struct + Protected ProtectedHeader + RawProtected cbor.RawMessage + RawUnprotected cbor.RawMessage + Unprotected UnprotectedHeader + func (h *Headers) MarshalProtected() ([]byte, error) + func (h *Headers) MarshalUnprotected() ([]byte, error) + func (h *Headers) UnmarshalFromRaw() error + type ProtectedHeader map[interface{}]interface + func (h *ProtectedHeader) UnmarshalCBOR(data []byte) error + func (h ProtectedHeader) Algorithm() (Algorithm, error) + func (h ProtectedHeader) Critical() ([]interface{}, error) + func (h ProtectedHeader) MarshalCBOR() ([]byte, error) + func (h ProtectedHeader) SetAlgorithm(alg Algorithm) + type Sign1Message struct + Headers Headers + Payload []byte + Signature []byte + func NewSign1Message() *Sign1Message + func (m *Sign1Message) MarshalCBOR() ([]byte, error) + func (m *Sign1Message) Sign(rand io.Reader, external []byte, signer Signer) error + func (m *Sign1Message) UnmarshalCBOR(data []byte) error + func (m *Sign1Message) Verify(external []byte, verifier Verifier) error + type SignMessage struct + Headers Headers + Payload []byte + Signatures []*Signature + func NewSignMessage() *SignMessage + func (m *SignMessage) MarshalCBOR() ([]byte, error) + func (m *SignMessage) Sign(rand io.Reader, external []byte, signers ...Signer) error + func (m *SignMessage) UnmarshalCBOR(data []byte) error + func (m *SignMessage) Verify(external []byte, verifiers ...Verifier) error + type Signature struct + Headers Headers + Signature []byte + func NewSignature() *Signature + func (s *Signature) MarshalCBOR() ([]byte, error) + func (s *Signature) Sign(rand io.Reader, signer Signer, protected cbor.RawMessage, ...) error + func (s *Signature) UnmarshalCBOR(data []byte) error + func (s *Signature) Verify(verifier Verifier, protected cbor.RawMessage, payload, external []byte) error + type Signer interface + Algorithm func() Algorithm + Sign func(rand io.Reader, content []byte) ([]byte, error) + func NewSigner(alg Algorithm, key crypto.Signer) (Signer, error) + type UnprotectedHeader map[interface{}]interface + func (h *UnprotectedHeader) UnmarshalCBOR(data []byte) error + func (h UnprotectedHeader) MarshalCBOR() ([]byte, error) + type Verifier interface + Algorithm func() Algorithm + Verify func(content, signature []byte) error + func NewVerifier(alg Algorithm, key crypto.PublicKey) (Verifier, error) v1.0.0-rc.2 Nov 14, 2022 v1.0.0-rc.1 Jul 11, 2022 v1.0.0-alpha.1 Apr 25, 2022 v0 v0.0.0-sign1-alpha.0 Apr 1, 2022