api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	TypeError   uint32 = 0
	TypeAttest  uint32 = 1
	TypeVerify  uint32 = 2
	TypeMeasure uint32 = 3
	TypeTLSSign uint32 = 4
	TypeTLSCert uint32 = 5
)
View Source
const (
	// Set maximum message length to 10 MB
	MaxMsgLen = 1024 * 1024 * 10
)

Variables

This section is empty.

Functions

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 -> CBOR-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 -> CBOR-encoded payload

func SendError

func SendError(conn net.Conn, format string, args ...interface{}) error

Types

type AttestationRequest

type AttestationRequest struct {
	Id    string `json:"id" cbor:"0,keyasint"`
	Nonce []byte `json:"nonce" nonce:"1,keyasint"`
}

type AttestationResponse

type AttestationResponse struct {
	AttestationReport []byte `json:"attestationReport" cbor:"0,keyasint"`
}

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 {
	Name         string `json:"name,omitempty" cbor:"0,keyasint,omitempty"`
	ConfigSha256 []byte `json:"configSha256,omitempty" cbor:"1,keyasint,omitempty"`
	RootfsSha256 []byte `json:"rootfsSha256,omitempty" cbor:"2,keyasint,omitempty"`
}

type MeasureResponse added in v0.7.0

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

type PSSOptions

type PSSOptions struct {
	SaltLength int32
}

type SocketError

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

type TLSCertRequest

type TLSCertRequest struct {
	Id string `json:"id" cbor:"0,keyasint"`
}

type TLSCertResponse

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

type TLSSignRequest

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

type TLSSignResponse

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

type VerificationRequest

type VerificationRequest struct {
	Nonce             []byte `json:"nonce" cbor:"0,keyasint"`
	AttestationReport []byte `json:"attestationReport" cbor:"1,keyasint"`
	Ca                []byte `json:"ca" cbor:"2,keyasint"`
	Policies          []byte `json:"policies" cbor:"3,keyasint"`
}

type VerificationResponse

type VerificationResponse struct {
	VerificationResult []byte `json:"verificationResult" cbor:"0,keyasint"`
}

Jump to

Keyboard shortcuts

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