mdoc

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2025 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go-mDoc

Go implementation of ISO 18013-5.

Documentation

Index

Constants

View Source
const (
	CipherSuiteVersion = 1
)
View Source
const (
	DeviceEngagementVersion = "1.0"
)
View Source
const (
	DeviceRequestVersion = "1.0"
)
View Source
const DeviceRetrievalVersion = 1
View Source
const (
	MobileSecurityObjectVersion = "1.0"
)

Variables

View Source
var (
	ErrEmptyTaggedValue   = errors.New("mdoc: cbor: empty tagged value")
	ErrEmptyUntaggedValue = errors.New("mdoc: cbor: empty untagged value")
)
View Source
var (
	ErrUnsupportedCurve     = errors.New("mdoc: unsupported curve")
	ErrUnsupportedAlgorithm = errors.New("mdoc: unsupported algorithm")
	ErrInvalidASN1Signature = errors.New("mdoc: invalid ASN1 signature")
)
View Source
var (
	ErrNoDeviceAuthPresent        = errors.New("mdoc: no device auth present")
	ErrMultipleDeviceAuthsPresent = errors.New("mdoc: multiple device auths present")

	ErrMACAuthNotSupported = errors.New("mdoc: MAC auth not supported")
)
View Source
var (
	ErrDeviceRequestUnsupportedVersion = errors.New("mdoc: unsupported device request version")
	ErrMissingReaderAuth               = errors.New("mdoc: missing reader auth")
)
View Source
var (
	ErrMissingDigest               = errors.New("mdoc: missing digest")
	ErrInvalidDigest               = errors.New("mdoc: incorrect digest")
	ErrUnauthorizedDeviceNameSpace = errors.New("mdoc: unauthorized device name space")
)
View Source
var (
	ErrInvalidIACARootCertificate        = errors.New("mdoc: invalid IACA root certificate")
	ErrUnexpectedIntermediateCertificate = errors.New("mdoc: unexpected intermediate certificate")
	ErrInvalidDocumentSignerCertificate  = errors.New("mdoc: invalid document signer certificate")
)
View Source
var (
	ErrIACAUnsupportedPublicKeyType                   = errors.New("mdoc: IACA unsupported public key type")
	ErrIACAUnsupportedValidityTooLong                 = errors.New("mdoc: IACA validity too long")
	ErrDocumentSignerUnsupportedPublicKeyType         = errors.New("mdoc: document signer unsupported public key type")
	ErrDocumentSignerValidityMustBeWithinIACAValidity = errors.New("mdoc: document signer must be within IACA validity")
	ErrDocumentSignerValidityTooLong                  = errors.New("mdoc: document signer validity too long")
	ErrDocumentSignerStateMustMatchIACA               = errors.New("mdoc: document signer state must match IACA")
)
View Source
var (
	ErrMissingAlgorithmHeader       = errors.New("mdoc: missing algorithm header")
	ErrNoRootCertificates           = errors.New("mdoc: no root certificates")
	ErrEmptyChain                   = errors.New("mdoc: empty chan")
	ErrInvalidReaderAuthCertificate = errors.New("mdoc: invalid reader auth certificate")
)
View Source
var (
	ErrInvalidCertificate = errors.New("mdoc: x500: invalid certificate")
)
View Source
var (
	ErrInvalidUUID = errors.New("mdoc: invalid UUID")
)
View Source
var (
	ErrUnrecognisedHeaderType = errors.New("mdoc: cose: unrecognized cose header type")
)
View Source
var (
	ErrUnrecognisedRetrievalMethod = errors.New("mdoc: unrecognized retrieval method")
)
View Source
var (
	ErrUnrecognizedHandover = errors.New("mdoc: unrecognized handover")
)
View Source
var (
	ErrUnsupportedDigestAlgorithm = errors.New("mdoc: unsupported digest algorithm")
)
View Source
var (
	ErrUnsupportedSignatureFormat = errors.New("mdoc: unsupported signature format")
)

Functions

func NewDocumentSignerCertificate

func NewDocumentSignerCertificate(
	rand io.Reader,
	signer crypto.Signer,
	iacaCertificate *x509.Certificate,
	publicKey crypto.PublicKey,
	serialNumber big.Int,
	commonName string,
	state *string,
	notBefore, notAfter time.Time,
) ([]byte, error)

func NewIACACertificate

func NewIACACertificate(
	rand io.Reader,
	signer crypto.Signer,
	publicKey crypto.PublicKey,
	serialNumber big.Int,
	commonName string,
	country string, state *string,
	notBefore, notAfter time.Time,
) ([]byte, error)

func SKDevice

func SKDevice(
	privateEDeviceKey PrivateEDeviceKey,
	deviceKey *DeviceKey,
	sessionTranscriptBytes []byte,
) ([]byte, error)

func SKReader

func SKReader(
	privateEDeviceKey PrivateEDeviceKey,
	deviceKey *DeviceKey,
	sessionTranscriptBytes []byte,
) ([]byte, error)

Types

type AuthorizedDataElements

type AuthorizedDataElements map[NameSpace]DataElementsArray

type AuthorizedNameSpaces

type AuthorizedNameSpaces []NameSpace

type BLEAddress

type BLEAddress [6]byte

type BLEOptions

type BLEOptions struct {
	SupportsPeripheralServer      bool        `cbor:"0,keyasint"`
	SupportsCentralClient         bool        `cbor:"1,keyasint"`
	PeripheralServerUUID          *UUID       `cbor:"10,keyasint,omitempty"`
	CentralClientUUID             *UUID       `cbor:"11,keyasint,omitempty"`
	PeripheralServerDeviceAddress *BLEAddress `cbor:"20,keyasint,omitempty"`
}

type Curve

type Curve int
const (
	CurveP256 Curve = iota
	CurveP384
	CurveP521
	CurveX25519
	CurveX448
	CurveEd25519
	CurveEd448
	CurveBrainpoolP256r1
	CurveBrainpoolP320r1
	CurveBrainpoolP384r1
	CurveBrainpoolP512r1
)

type DataElementIdentifier

type DataElementIdentifier string

type DataElementValue

type DataElementValue any

type DataElementsArray

type DataElementsArray []DataElementIdentifier

type DeviceAuth

type DeviceAuth struct {
	DeviceSignature *DeviceSignature `cbor:",omitempty"`
	DeviceMAC       *DeviceMAC       `cbor:",omitempty"`
}

func NewDeviceAuth

func NewDeviceAuth(
	rand io.Reader,
	privateSDeviceKey PrivateSDeviceKey,
	deviceAuthenticationBytes *TaggedEncodedCBOR,
) (*DeviceAuth, error)

func (*DeviceAuth) Verify

func (da *DeviceAuth) Verify(
	deviceKey *DeviceKey,
	deviceAuthenticationBytes *TaggedEncodedCBOR,
) error

type DeviceAuthentication

type DeviceAuthentication struct {
	DeviceAuthentication string
	SessionTranscript    SessionTranscript
	DocType              DocType
	DeviceNameSpaceBytes TaggedEncodedCBOR
	// contains filtered or unexported fields
}

func NewDeviceAuthentication

func NewDeviceAuthentication(
	sessionTranscript *SessionTranscript,
	docType DocType,
	deviceNameSpaceBytes *TaggedEncodedCBOR,
) *DeviceAuthentication

type DeviceEngagement

type DeviceEngagement struct {
	Version                string                  `cbor:"0,keyasint"`
	Security               Security                `cbor:"1,keyasint"`
	DeviceRetrievalMethods []DeviceRetrievalMethod `cbor:"2,keyasint,omitempty"`
	ServerRetrievalMethods []any                   `cbor:"3,keyasint,omitempty"` // TODO
	ProtocolInfo           any                     `cbor:"4,keyasint,omitempty"` // TODO
}

func NewDeviceEngagementBLE

func NewDeviceEngagementBLE(
	eDeviceKey *DeviceKey,
	centralClientUUID, peripheralServerUUID *UUID,
) (*DeviceEngagement, error)

func (*DeviceEngagement) EDeviceKey

func (de *DeviceEngagement) EDeviceKey() (*DeviceKey, error)

type DeviceKey

type DeviceKey cose.Key

func (*DeviceKey) MarshalCBOR

func (dk *DeviceKey) MarshalCBOR() ([]byte, error)

func (*DeviceKey) UnmarshalCBOR

func (dk *DeviceKey) UnmarshalCBOR(data []byte) error

type DeviceKeyInfo

type DeviceKeyInfo struct {
	DeviceKey         DeviceKey          `cbor:"deviceKey"`
	KeyAuthorizations *KeyAuthorizations `cbor:"keyAuthorizations,omitempty"`
	KeyInfo           *KeyInfo           `cbor:"keyInfo,omitEmpty"`
}

type DeviceMAC

type DeviceMAC any // TODO type DeviceMAC cose.MAC0Message

type DeviceNameSpaces

type DeviceNameSpaces map[NameSpace]DeviceSignedItems

func (DeviceNameSpaces) Contains

func (dns DeviceNameSpaces) Contains(nameSpace NameSpace, dataElementIdentifier DataElementIdentifier) bool

func (DeviceNameSpaces) Verify

func (dns DeviceNameSpaces) Verify(
	mobileSecurityObject *MobileSecurityObject,
) error

type DeviceRequest

type DeviceRequest struct {
	Version     string       `cbor:"version"`
	DocRequests []DocRequest `cbor:"docRequests"`
}

func NewDeviceRequest

func NewDeviceRequest(docRequests []DocRequest) *DeviceRequest

func (*DeviceRequest) Verify

func (dr *DeviceRequest) Verify(
	rootCertificates []*x509.Certificate,
	now time.Time,
	sessionTranscript *SessionTranscript,
) error

type DeviceResponse

type DeviceResponse struct {
	Version        string          `cbor:"version"`
	Documents      []Document      `cbor:"documents,omitempty"`
	DocumentErrors []DocumentError `cbor:"documentErrors,omitempty"`
	Status         StatusCode      `cbor:"status"`
}

func CreateDeviceResponse

func CreateDeviceResponse(
	deviceRequest *DeviceRequest,
	candidateIssuerSigneds map[DocType]IssuerSigned,
	candidateDeviceSigneds map[DocType]map[NameSpace]map[DataElementIdentifier]any,
	rand io.Reader,
	privateSDeviceKey PrivateSDeviceKey,
	sessionTranscript *SessionTranscript,
) (*DeviceResponse, error)

func NewDeviceResponse

func NewDeviceResponse(
	documents []Document,
	documentErrors []DocumentError,
	status StatusCode,
) *DeviceResponse

type DeviceRetrievalMethod

type DeviceRetrievalMethod struct {
	Type             DeviceRetrievalMethodType
	Version          uint
	RetrievalOptions RetrievalOptions
}

func (*DeviceRetrievalMethod) MarshalCBOR

func (drm *DeviceRetrievalMethod) MarshalCBOR() ([]byte, error)

func (*DeviceRetrievalMethod) UnmarshalCBOR

func (drm *DeviceRetrievalMethod) UnmarshalCBOR(data []byte) error

type DeviceRetrievalMethodType

type DeviceRetrievalMethodType uint
const (
	DeviceRetrievalMethodTypeNFC       DeviceRetrievalMethodType = 1
	DeviceRetrievalMethodTypeBLE       DeviceRetrievalMethodType = 2
	DeviceRetrievalMethodTypeWiFiAware DeviceRetrievalMethodType = 3
)

type DeviceSignature

type DeviceSignature cose.UntaggedSign1Message

func (*DeviceSignature) MarshalCBOR

func (ds *DeviceSignature) MarshalCBOR() ([]byte, error)

func (*DeviceSignature) UnmarshalCBOR

func (ds *DeviceSignature) UnmarshalCBOR(data []byte) error

type DeviceSigned

type DeviceSigned struct {
	NameSpacesBytes TaggedEncodedCBOR `cbor:"nameSpaces"`
	DeviceAuth      DeviceAuth        `cbor:"deviceAuth"`
}

func NewDeviceSigned

func NewDeviceSigned(
	docType DocType,
	nameSpaces DeviceNameSpaces,
	rand io.Reader,
	privateSDeviceKey PrivateSDeviceKey,
	sessionTranscript *SessionTranscript,
) (*DeviceSigned, error)

func (*DeviceSigned) NameSpaces

func (ds *DeviceSigned) NameSpaces() (DeviceNameSpaces, error)

func (*DeviceSigned) Verify

func (ds *DeviceSigned) Verify(
	deviceKey *DeviceKey,
	deviceAuthenticationBytes *TaggedEncodedCBOR,
	mobileSecurityObject *MobileSecurityObject,
) error

type Digest

type Digest []byte

type DigestAlgorithm

type DigestAlgorithm string
const (
	DigestAlgorithmSHA256 DigestAlgorithm = "SHA-256"
	DigestAlgorithmSHA384 DigestAlgorithm = "SHA-384"
	DigestAlgorithmSHA512 DigestAlgorithm = "SHA-512"
	DigestAlgorithmNone   DigestAlgorithm = "none"
)

func (*DigestAlgorithm) Hash

func (da *DigestAlgorithm) Hash() (hash.Hash, error)

type DigestID

type DigestID uint

type DocRequest

type DocRequest struct {
	ItemsRequestBytes TaggedEncodedCBOR `cbor:"itemsRequest"`
	ReaderAuth        *ReaderAuth       `cbor:"readerAuth,omitempty"`
}

func NewAuthenticatedDocRequest

func NewAuthenticatedDocRequest(
	rand io.Reader,
	readerAuthority ReaderAuthority,
	itemsRequest *ItemsRequest,
	sessionTranscript *SessionTranscript,
) (*DocRequest, error)

func NewDocRequest

func NewDocRequest(itemsRequest *ItemsRequest) (*DocRequest, error)

func (DocRequest) ItemsRequest

func (dr DocRequest) ItemsRequest() (*ItemsRequest, error)

func (DocRequest) Verify

func (dr DocRequest) Verify(
	rootCertificates []*x509.Certificate,
	now time.Time,
	sessionTranscript *SessionTranscript,
) error

type DocType

type DocType string

type Document

type Document struct {
	DocType      DocType      `cbor:"docType"`
	IssuerSigned IssuerSigned `cbor:"issuerSigned"`
	DeviceSigned DeviceSigned `cbor:"deviceSigned"`
	Errors       *Errors      `cbor:"errors,omitempty"`
}

func (*Document) Verify

func (d *Document) Verify(
	rootCertificates []*x509.Certificate,
	now time.Time,
	sessionTranscript *SessionTranscript,
) error

type DocumentError

type DocumentError map[DocType]ErrorCode

type ErrorCode

type ErrorCode int
const (
	ErrorCodeDataNotReturned ErrorCode = 0
)

type ErrorItems

type ErrorItems map[DataElementIdentifier]ErrorCode

type Errors

type Errors map[NameSpace]ErrorItems

type Handover

type Handover any

type IntentToRetain

type IntentToRetain bool

type IssuerAuth

type IssuerAuth cose.UntaggedSign1Message

func NewIssuerAuth

func NewIssuerAuth(
	rand io.Reader,
	issuerAuthority IssuerAuthority,
	mobileSecurityObject *MobileSecurityObject,
) (*IssuerAuth, error)

func (*IssuerAuth) MarshalCBOR

func (ia *IssuerAuth) MarshalCBOR() ([]byte, error)

func (*IssuerAuth) MobileSecurityObject

func (ia *IssuerAuth) MobileSecurityObject() (*MobileSecurityObject, error)

func (*IssuerAuth) MobileSecurityObjectBytes

func (ia *IssuerAuth) MobileSecurityObjectBytes() (*TaggedEncodedCBOR, error)

func (*IssuerAuth) UnmarshalCBOR

func (ia *IssuerAuth) UnmarshalCBOR(data []byte) error

func (*IssuerAuth) Verify

func (ia *IssuerAuth) Verify(rootCertificates []*x509.Certificate, now time.Time) error

type IssuerAuthority

type IssuerAuthority interface {
	Signer
	IACACertificate() *x509.Certificate
	DocumentSignerCertificate() *x509.Certificate
}

type IssuerNameSpaces

type IssuerNameSpaces map[NameSpace]IssuerSignedItemBytess

func (IssuerNameSpaces) Filter

func (ins IssuerNameSpaces) Filter(filter func(nameSpace NameSpace, dataElementIdentifier DataElementIdentifier) bool) (IssuerNameSpaces, error)

func (IssuerNameSpaces) IssuerSignedItems

func (ins IssuerNameSpaces) IssuerSignedItems() (IssuerSignedItems, error)

type IssuerSigned

type IssuerSigned struct {
	NameSpaces IssuerNameSpaces `cbor:"nameSpaces,omitempty"`
	IssuerAuth IssuerAuth       `cbor:"issuerAuth"`
}

func (IssuerSigned) Verify

func (is IssuerSigned) Verify(rootCertificates []*x509.Certificate, now time.Time) (*MobileSecurityObject, error)

type IssuerSignedItem

type IssuerSignedItem struct {
	DigestID          DigestID              `cbor:"digestID"`
	Random            []byte                `cbor:"random"`
	ElementIdentifier DataElementIdentifier `cbor:"elementIdentifier"`
	ElementValue      DataElementValue      `cbor:"elementValue"`
}

type IssuerSignedItemBytes

type IssuerSignedItemBytes TaggedEncodedCBOR

func (*IssuerSignedItemBytes) IssuerSignedItem

func (isib *IssuerSignedItemBytes) IssuerSignedItem() (*IssuerSignedItem, error)

func (*IssuerSignedItemBytes) MarshalCBOR

func (isib *IssuerSignedItemBytes) MarshalCBOR() ([]byte, error)

func (*IssuerSignedItemBytes) UnmarshalCBOR

func (isib *IssuerSignedItemBytes) UnmarshalCBOR(data []byte) error

type IssuerSignedItemBytess

type IssuerSignedItemBytess []IssuerSignedItemBytes

type IssuerSignedItems

type IssuerSignedItems map[NameSpace][]IssuerSignedItem

func (IssuerSignedItems) Contains

func (isi IssuerSignedItems) Contains(nameSpace NameSpace, dataElementIdentifier DataElementIdentifier) bool

type ItemsRequest

type ItemsRequest struct {
	DocType     DocType        `cbor:"docType"`
	NameSpaces  NameSpaces     `cbor:"nameSpaces"`
	RequestInfo map[string]any `cbor:"requestInfo"`
}

type KeyAuthorizations

type KeyAuthorizations struct {
	NameSpaces   *AuthorizedNameSpaces   `cbor:"nameSpaces,omitempty"`
	DataElements *AuthorizedDataElements `cbor:"dataElements,omitempty"`
}

func (*KeyAuthorizations) Contains

func (ka *KeyAuthorizations) Contains(nameSpace NameSpace, dataElementIdentifier DataElementIdentifier) bool

type KeyInfo

type KeyInfo map[int]any

type MobileSecurityObject

type MobileSecurityObject struct {
	Version         string           `cbor:"version"`
	DigestAlgorithm DigestAlgorithm  `cbor:"digestAlgorithm"`
	ValueDigests    NameSpaceDigests `cbor:"valueDigests"`
	DeviceKeyInfo   DeviceKeyInfo    `cbor:"deviceKeyInfo"`
	DocType         DocType          `cbor:"docType"`
	ValidityInfo    ValidityInfo     `cbor:"validityInfo"`
}

func NewMobileSecurityObject

func NewMobileSecurityObject(
	docType DocType,
	digestAlgorithm DigestAlgorithm,
	nameSpaces IssuerNameSpaces,
	deviceKey *DeviceKey,
	validityInfo *ValidityInfo,
	keyAuthorizations *KeyAuthorizations,
	keyInfo *KeyInfo,
) (*MobileSecurityObject, error)

type NFCHandover

type NFCHandover struct {
	HandoverSelect  []byte
	HandoverRequest []byte `cbor:",omitempty"`
	// contains filtered or unexported fields
}

type NFCOptions

type NFCOptions struct {
	MaxLengthCommandData  uint `cbor:"0,keyasint"`
	MaxLengthResponseData uint `cbor:"1,keyasint"`
}

type NameSpace

type NameSpace string

type NameSpaceDigests

type NameSpaceDigests map[NameSpace]ValueDigests

type NameSpaces

type NameSpaces map[NameSpace]DataElements

func (NameSpaces) Contains

func (ns NameSpaces) Contains(nameSpace NameSpace, dataElementIdentifier DataElementIdentifier) bool

func (NameSpaces) Filter

func (ns NameSpaces) Filter(filter func(nameSpace NameSpace, dataElementIdentifier DataElementIdentifier) bool) NameSpaces

type PrivateEDeviceKey

type PrivateEDeviceKey interface {
	DeviceKey() (*DeviceKey, error)
	Curve() Curve
	Agree(*DeviceKey) ([]byte, error)
}

func NewEDeviceKey

func NewEDeviceKey(rand io.Reader, curve Curve) (PrivateEDeviceKey, error)

type PrivateSDeviceKey

type PrivateSDeviceKey interface {
	PrivateEDeviceKey
	Signer
	Mode() SDeviceKeyMode
}

func NewSDeviceKey

func NewSDeviceKey(rand io.Reader, curve Curve, mode SDeviceKeyMode) (PrivateSDeviceKey, error)

type QRHandover

type QRHandover struct{}

func (*QRHandover) MarshalCBOR

func (qrh *QRHandover) MarshalCBOR() ([]byte, error)

func (*QRHandover) UnmarshalCBOR

func (qrh *QRHandover) UnmarshalCBOR(data []byte) error

type ReaderAuth

type ReaderAuth cose.UntaggedSign1Message

func NewReaderAuth

func NewReaderAuth(
	rand io.Reader,
	readerAuthority ReaderAuthority,
	readerAuthenticationBytes *TaggedEncodedCBOR,
) (*ReaderAuth, error)

func (*ReaderAuth) MarshalCBOR

func (ra *ReaderAuth) MarshalCBOR() ([]byte, error)

func (*ReaderAuth) UnmarshalCBOR

func (ra *ReaderAuth) UnmarshalCBOR(data []byte) error

func (*ReaderAuth) Verify

func (ra *ReaderAuth) Verify(
	rootCertificates []*x509.Certificate,
	now time.Time,
	readerAuthenticationBytes *TaggedEncodedCBOR,
) error

type ReaderAuthentication

type ReaderAuthentication struct {
	ReaderAuthentication string
	SessionTranscript    SessionTranscript
	ItemsRequestBytes    TaggedEncodedCBOR
	// contains filtered or unexported fields
}

func NewReaderAuthentication

func NewReaderAuthentication(
	sessionTranscript *SessionTranscript,
	itemsRequestBytes *TaggedEncodedCBOR,
) *ReaderAuthentication

type ReaderAuthority

type ReaderAuthority interface {
	Signer
	RootCertificate() *x509.Certificate
}

type RetrievalOptions

type RetrievalOptions any

type SDeviceKeyMode

type SDeviceKeyMode int
const (
	SDeviceKeyModeSign SDeviceKeyMode = iota
	SDeviceKeyModeMAC
)

type Security

type Security struct {
	CipherSuiteIdentifier int
	EDeviceKeyBytes       TaggedEncodedCBOR
	// contains filtered or unexported fields
}

type SessionData

type SessionData struct {
	Data   []byte        `cbor:"data"`
	Status SessionStatus `cbor:"status"`
}

type SessionEncryption

type SessionEncryption struct {
	// contains filtered or unexported fields
}

func NewDeviceSessionEncryption

func NewDeviceSessionEncryption(
	skDevice []byte,
	skReader []byte,
) (*SessionEncryption, error)

func NewReaderSessionEncryption

func NewReaderSessionEncryption(
	skReader []byte,
	skDevice []byte,
) (*SessionEncryption, error)

func (*SessionEncryption) Decrypt

func (se *SessionEncryption) Decrypt(cipherText []byte) ([]byte, error)

func (*SessionEncryption) Encrypt

func (se *SessionEncryption) Encrypt(clearText []byte) []byte

type SessionEstablishment

type SessionEstablishment struct {
	EReaderKeyBytes TaggedEncodedCBOR `cbor:"eReaderKey"`
	Data            []byte            `cbor:"data"`
}

func NewSessionEstablishment

func NewSessionEstablishment(eReaderKey *DeviceKey, data []byte) (*SessionEstablishment, error)

func (*SessionEstablishment) EReaderKey

func (se *SessionEstablishment) EReaderKey() (*DeviceKey, error)

type SessionStatus

type SessionStatus uint
const (
	SessionStatusErrorSessionEncryption SessionStatus = 10
	SessionStatusErrorCBORDecoding      SessionStatus = 11
	SessionStatusSessionTermination     SessionStatus = 20
)

type SessionTranscript

type SessionTranscript struct {
	DeviceEngagementBytes *TaggedEncodedCBOR
	EReaderKeyBytes       *TaggedEncodedCBOR
	Handover              Handover
}

func (*SessionTranscript) MarshalCBOR

func (st *SessionTranscript) MarshalCBOR() ([]byte, error)

func (*SessionTranscript) UnmarshalCBOR

func (st *SessionTranscript) UnmarshalCBOR(data []byte) error

type Signer

type Signer interface {
	Curve() Curve
	Sign(rand io.Reader, data []byte) ([]byte, error)
}

type StatusCode

type StatusCode uint
const (
	StatusCodeOK                  StatusCode = 0
	StatusCodeGeneralError        StatusCode = 10
	StatusCodeCBORDecodingError   StatusCode = 11
	StatusCodeCBORValidationError StatusCode = 12
)

type TaggedEncodedCBOR

type TaggedEncodedCBOR struct {
	TaggedValue   bstr
	UntaggedValue bstr
}

func MarshalToNewTaggedEncodedCBOR

func MarshalToNewTaggedEncodedCBOR(value any) (*TaggedEncodedCBOR, error)

func NewDeviceAuthenticationBytes

func NewDeviceAuthenticationBytes(
	sessionTranscript *SessionTranscript,
	docType DocType,
	deviceNameSpaceBytes *TaggedEncodedCBOR,
) (*TaggedEncodedCBOR, error)

func NewReaderAuthenticationBytes

func NewReaderAuthenticationBytes(
	sessionTranscript *SessionTranscript,
	itemsRequestBytes *TaggedEncodedCBOR,
) (*TaggedEncodedCBOR, error)

func NewTaggedEncodedCBOR

func NewTaggedEncodedCBOR(untaggedValue []byte) (*TaggedEncodedCBOR, error)

func (*TaggedEncodedCBOR) MarshalCBOR

func (tec *TaggedEncodedCBOR) MarshalCBOR() ([]byte, error)

func (*TaggedEncodedCBOR) UnmarshalCBOR

func (tec *TaggedEncodedCBOR) UnmarshalCBOR(taggedValue []byte) error

type UUID

type UUID [128 / 8]byte

func NewUUID

func NewUUID(rand io.Reader) (*UUID, error)

func UUIDFromBytes

func UUIDFromBytes(b []byte) (*UUID, error)

type ValidityInfo

type ValidityInfo struct {
	Signed         time.Time
	ValidFrom      time.Time
	ValidUntil     time.Time
	ExpectedUpdate *time.Time
}

type ValueDigests

type ValueDigests map[DigestID]Digest

type WifiOptions

type WifiOptions struct {
	PassPhraseInfoPassPhrase  string `cbor:"0,keyasint,omitempty"`
	ChannelInfoOperatingClass uint   `cbor:"1,keyasint,omitempty"`
	ChannelInfoChannelNumber  uint   `cbor:"2,keyasint,omitempty"`
	BandInfoSupportedBands    []byte `cbor:"3,keyasint,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址