api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Contains the API definitions for the CoAP and socket API. The gRPC API is in a separate file

Contains the API definitions for the CoAP and socket API. The gRPC API is in a separate file

Index

Constants

View Source
const (
	EndpointAttest    = "/Attest"
	EndpointVerify    = "/Verify"
	EndpointTLSSign   = "/TLSSign"
	EndpointTLSCert   = "/TLSCert"
	EndpointPeerCache = "/PeerCache"
	EndpointMeasure   = "/Measure"
)
View Source
const (
	TypeError     uint32 = 0
	TypeAttest    uint32 = 1
	TypeVerify    uint32 = 2
	TypeTLSSign   uint32 = 3
	TypeTLSCert   uint32 = 4
	TypePeerCache uint32 = 5
	TypeMeasure   uint32 = 6
)
View Source
const (
	// Set maximum message length to 10 MB
	MaxMsgLen = 1024 * 1024 * 10
)

Variables

This section is empty.

Functions

func GetVersion added in v0.8.0

func GetVersion() string

func HashToSignerOpts

func HashToSignerOpts(hashtype HashFunction, pssOpts *PSSOptions) (crypto.SignerOpts, error)

Converts Protobuf hashtype to crypto.SignerOpts

func Receive

func Receive(conn net.Conn) ([]byte, uint32, error)

Receive receives data from a socket with the following format

Len uint32 -> Length of the payload to be sent
Type uint32 -> Type of the payload
payload []byte -> encoded payload

func Send

func Send(conn net.Conn, payload []byte, t uint32) error

Send sends data to a socket with the following format

Len uint32 -> Length of the payload to be sent
Type uint32 -> Type of the payload
payload []byte -> encoded payload

func TypeToString added in v0.8.0

func TypeToString(t uint32) string

Types

type AttestationRequest

type AttestationRequest struct {
	Version string   `json:"version" cbor:"0,keyasint"`
	Nonce   []byte   `json:"nonce" cbor:"1,keyasint"`
	Cached  []string `json:"cached,omitempty" cbor:"2,keyasint,omitempty"`
}

func (*AttestationRequest) CheckVersion added in v0.8.0

func (req *AttestationRequest) CheckVersion() error

type AttestationResponse

type AttestationResponse struct {
	Version     string            `json:"version" cbor:"0,keyasint"`
	Report      []byte            `json:"report" cbor:"1,keyasint"`
	Metadata    map[string][]byte `json:"metadata,omitempty" cbor:"2,keyasint,omitempty"`
	CacheMisses []string          `json:"cacheMisses,omitempty" cbor:"3,keyasint,omitempty"`
}

func (*AttestationResponse) CheckVersion added in v0.8.0

func (resp *AttestationResponse) CheckVersion() error

type HashFunction

type HashFunction int32
const (
	HashFunction_SHA1        HashFunction = 0
	HashFunction_SHA224      HashFunction = 1
	HashFunction_SHA256      HashFunction = 2
	HashFunction_SHA384      HashFunction = 3
	HashFunction_SHA512      HashFunction = 4
	HashFunction_MD4         HashFunction = 5
	HashFunction_MD5         HashFunction = 6
	HashFunction_MD5SHA1     HashFunction = 7
	HashFunction_RIPEMD160   HashFunction = 8
	HashFunction_SHA3_224    HashFunction = 9
	HashFunction_SHA3_256    HashFunction = 10
	HashFunction_SHA3_384    HashFunction = 11
	HashFunction_SHA3_512    HashFunction = 12
	HashFunction_SHA512_224  HashFunction = 13
	HashFunction_SHA512_256  HashFunction = 14
	HashFunction_BLAKE2s_256 HashFunction = 15
	HashFunction_BLAKE2b_256 HashFunction = 16
	HashFunction_BLAKE2b_384 HashFunction = 17
	HashFunction_BLAKE2b_512 HashFunction = 18
)

func SignerOptsToHash

func SignerOptsToHash(opts crypto.SignerOpts) (HashFunction, error)

Converts Hash Types from crypto.SignerOpts to the types specified in the CMC interface

type MeasureRequest added in v0.7.0

type MeasureRequest struct {
	Version string          `json:"version" cbor:"0,keyasint"`
	Event   ar.MeasureEvent `json:"event" cbor:"1,keyasint"`
}

func (*MeasureRequest) CheckVersion added in v0.8.0

func (req *MeasureRequest) CheckVersion() error

type MeasureResponse added in v0.7.0

type MeasureResponse struct {
	Version string `json:"version" cbor:"0,keyasint"`
	Success bool   `json:"success" cbor:"1,keyasint"`
}

func (*MeasureResponse) CheckVersion added in v0.8.0

func (resp *MeasureResponse) CheckVersion() error

type PSSOptions

type PSSOptions struct {
	SaltLength int32
}

type PeerCacheRequest added in v0.8.0

type PeerCacheRequest struct {
	Version string `json:"version" cbor:"0,keyasint"`
	Peer    string `json:"peer" cbor:"1,keyasint"`
}

func (*PeerCacheRequest) CheckVersion added in v0.8.0

func (req *PeerCacheRequest) CheckVersion() error

type PeerCacheResponse added in v0.8.0

type PeerCacheResponse struct {
	Version string   `json:"version" cbor:"0,keyasint"`
	Cache   []string `json:"cache" cbor:"1,keyasint"`
}

func (*PeerCacheResponse) CheckVersion added in v0.8.0

func (resp *PeerCacheResponse) CheckVersion() error

type SocketError

type SocketError struct {
	Version string `json:"version" cbor:"0,keyasint"`
	Msg     string `json:"msg" cbor:"1,keyasint"`
}

func (*SocketError) CheckVersion added in v0.8.0

func (err *SocketError) CheckVersion() error

type TLSCertRequest

type TLSCertRequest struct {
	Version string `json:"version" cbor:"0,keyasint"`
}

func (*TLSCertRequest) CheckVersion added in v0.8.0

func (req *TLSCertRequest) CheckVersion() error

type TLSCertResponse

type TLSCertResponse struct {
	Version     string   `json:"version" cbor:"0,keyasint"`
	Certificate [][]byte `json:"certificate" cbor:"1,keyasint"`
}

func (*TLSCertResponse) CheckVersion added in v0.8.0

func (resp *TLSCertResponse) CheckVersion() error

type TLSSignRequest

type TLSSignRequest struct {
	Version  string       `json:"version" cbor:"0,keyasint"`
	Content  []byte       `json:"content" cbor:"1,keyasint"`
	Hashtype HashFunction `json:"hashType" cbor:"2,keyasint"`
	PssOpts  *PSSOptions  `json:"pssOpts" cbor:"3,keyasint"`
}

func (*TLSSignRequest) CheckVersion added in v0.8.0

func (req *TLSSignRequest) CheckVersion() error

type TLSSignResponse

type TLSSignResponse struct {
	Version       string `json:"version" cbor:"0,keyasint"`
	SignedContent []byte `json:"signedContent" cbor:"1,keyasint"`
}

func (*TLSSignResponse) CheckVersion added in v0.8.0

func (resp *TLSSignResponse) CheckVersion() error

type VerificationRequest

type VerificationRequest struct {
	Version     string            `json:"version" cbor:"0,keyasint"`
	Nonce       []byte            `json:"nonce" cbor:"1,keyasint"`
	Report      []byte            `json:"report" cbor:"2,keyasint"`
	Metadata    map[string][]byte `json:"metadata,omitempty" cbor:"3,keyasint,omitempty"`
	Ca          []byte            `json:"ca" cbor:"4,keyasint"`
	Peer        string            `json:"peer,omitempty" cbor:"5,keyasint,omitempty"`
	CacheMisses []string          `json:"cacheMisses,omitempty" cbor:"6,keyasint,omitempty"`
	Policies    []byte            `json:"policies,omitempty" cbor:"7,keyasint,omitempty"`
}

func (*VerificationRequest) CheckVersion added in v0.8.0

func (req *VerificationRequest) CheckVersion() error

type VerificationResponse

type VerificationResponse struct {
	Version string                `json:"version" cbor:"0,keyasint"`
	Result  ar.VerificationResult `json:"result" cbor:"1,keyasint"`
}

func (*VerificationResponse) CheckVersion added in v0.8.0

func (resp *VerificationResponse) CheckVersion() error

Jump to

Keyboard shortcuts

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