Documentation
¶
Overview ¶
CCA Realm Claims
Index ¶
- Constants
- Variables
- func ECDSAPublicKeyFromCOSEKey(buf []byte) (*ecdsa.PublicKey, error)
- func ECDSAPublicKeyFromRaw(data []byte) (*ecdsa.PublicKey, error)
- func EncodeClaimsToCBOR(c IClaims) ([]byte, error)
- func EncodeClaimsToJSON(c IClaims) ([]byte, error)
- func ValidateAndEncodeClaimsToCBOR(c IClaims) ([]byte, error)
- func ValidateAndEncodeClaimsToJSON(c IClaims) ([]byte, error)
- func ValidateChallenge(v []byte) error
- func ValidateClaims(c IClaims) error
- func ValidateExtendedMeas(v [][]byte) error
- func ValidateHashAlgID(v string) error
- func ValidatePersonalizationValue(b []byte) error
- func ValidateRealmMeas(b []byte) error
- func ValidateRealmPubKey(b []byte) error
- func ValidateRealmPubKeyCOSE(b []byte) error
- type Claims
- func (c Claims) GetChallenge() ([]byte, error)
- func (c Claims) GetExtensibleMeasurements() ([][]byte, error)
- func (c Claims) GetHashAlgID() (string, error)
- func (c Claims) GetInitialMeasurement() ([]byte, error)
- func (c Claims) GetPersonalizationValue() ([]byte, error)
- func (c *Claims) GetProfile() (string, error)
- func (c Claims) GetPubKey() ([]byte, error)
- func (c Claims) GetPubKeyHashAlgID() (string, error)
- func (c *Claims) SetChallenge(v []byte) error
- func (c *Claims) SetExtensibleMeasurements(v [][]byte) error
- func (c *Claims) SetHashAlgID(v string) error
- func (c *Claims) SetInitialMeasurement(v []byte) error
- func (c *Claims) SetPersonalizationValue(v []byte) error
- func (c *Claims) SetPubKey(v []byte) error
- func (c *Claims) SetPubKeyHashAlgID(v string) error
- func (c Claims) Validate() error
- type IClaims
Constants ¶
const (
MaxLenRealmExtendedMeas = 4
)
const ProfileName = "tag:arm.com,2023:realm#1.0.0"
Variables ¶
var ( // TestRAKPubRaw needs to be public because it is used also by tests in the // ccatoken package. TestRAKPubRaw = []byte{ 0x04, 0x81, 0x19, 0x58, 0x80, 0xa2, 0x20, 0x7f, 0xb9, 0x56, 0x03, 0x2a, 0x3c, 0xb9, 0x7f, 0x5d, 0xa5, 0xaf, 0x72, 0x6f, 0xfc, 0xb7, 0x15, 0xee, 0x16, 0x47, 0x84, 0xa7, 0xfb, 0x16, 0xc0, 0x60, 0x96, 0xbd, 0xd9, 0x46, 0x2a, 0x32, 0x65, 0x0b, 0x29, 0x12, 0xa8, 0x55, 0x15, 0x70, 0xd6, 0xea, 0x1f, 0x3b, 0x2d, 0x1f, 0x7d, 0xa8, 0xa2, 0x75, 0xfa, 0x00, 0x33, 0x0f, 0x00, 0x78, 0x61, 0x8b, 0xc3, 0xe1, 0x49, 0x54, 0x9c, 0x81, 0x70, 0xd3, 0x2e, 0xc5, 0x58, 0x90, 0xa7, 0xf9, 0xec, 0x78, 0x9f, 0x1f, 0x18, 0xae, 0x92, 0xeb, 0x15, 0xd2, 0x22, 0xaf, 0x97, 0x1d, 0x97, 0x1c, 0x96, 0x5a, 0xf1, } // TestAltRAKPubCOSE needs to be public because it is used also by tests in // the ccatoken package. TestAltRAKPubCOSE = []byte{}/* 107 elements not displayed */ )
Functions ¶
func EncodeClaimsToCBOR ¶
EncodeClaimsToCBOR marshals CCA realm claims to CBOR.
func EncodeClaimsToJSON ¶
EncodeClaimsToJSON marshals CCA realm claims to JSON.
func ValidateAndEncodeClaimsToCBOR ¶
ValidateAndEncodeClaimsToCBOR validates and then marshals CCA realm claims to CBOR.
func ValidateAndEncodeClaimsToJSON ¶
ValidateAndEncodeClaimsToJSON validates and then marshals CCA realm claims to JSON.
func ValidateChallenge ¶
ValidateChallenge returns an error if the provided value does not contain a valid CCA challenge.
func ValidateClaims ¶
ValidateClaims returns an error if the provided IClaims instance does not contain a valid set of CCA realm claims.
func ValidateExtendedMeas ¶
ValidateExtendedMeas returns an error if the provided slice does not contain valid realm extended measurements (it must be non-empty, and each value must be a valid ream measurement).
func ValidateHashAlgID ¶
ValidateHashAlgID returns an error if the provided value is not a valid hash algorithm string.
func ValidatePersonalizationValue ¶
ValidatePersonalizationValue returns an error if the provided value is not a valid personalization value (must be exactly 64 bytes long).
func ValidateRealmMeas ¶
ValidateRealmMeas returns an error if the provided value does not contain a valid realm measurement (must be 32, 48, or 64 bytes long).
func ValidateRealmPubKey ¶
ValidateRealmPubKey returns an error if the provided value does not contain a valid realm public key (must 97-byte ECC-P384).
func ValidateRealmPubKeyCOSE ¶
ValidateRealmPubKeyCOSE returns an error if the provided value does not contain a valid realm public key in CBOR-encoded COSE_Key format
Types ¶
type Claims ¶
type Claims struct {
Profile *eat.Profile `cbor:"265,keyasint" json:"cca-realm-profile,omitempty"`
Challenge *eat.Nonce `cbor:"10,keyasint" json:"cca-realm-challenge"`
PersonalizationValue *[]byte `cbor:"44235,keyasint" json:"cca-realm-personalization-value"`
InitialMeasurement *[]byte `cbor:"44238,keyasint" json:"cca-realm-initial-measurement"`
ExtensibleMeasurements *[][]byte `cbor:"44239,keyasint" json:"cca-realm-extensible-measurements"`
HashAlgID *string `cbor:"44236,keyasint" json:"cca-realm-hash-algo-id"`
PublicKey *[]byte `cbor:"44237,keyasint" json:"cca-realm-public-key"`
PublicKeyHashAlgID *string `cbor:"44240,keyasint" json:"cca-realm-public-key-hash-algo-id"`
}
Claims contains the CCA realm claims. It implements IClaims, which is an extension of psatoken.IClaimBase.
func (Claims) GetExtensibleMeasurements ¶
func (Claims) GetHashAlgID ¶
func (Claims) GetInitialMeasurement ¶
func (Claims) GetPersonalizationValue ¶
func (*Claims) GetProfile ¶
If profile is not found return ErrOptionalClaimMissing
func (Claims) GetPubKeyHashAlgID ¶
func (*Claims) SetChallenge ¶
func (*Claims) SetExtensibleMeasurements ¶
func (*Claims) SetHashAlgID ¶
func (*Claims) SetInitialMeasurement ¶
func (*Claims) SetPersonalizationValue ¶
func (*Claims) SetPubKeyHashAlgID ¶
type IClaims ¶
type IClaims interface {
psatoken.IClaimsBase
// Getters
GetChallenge() ([]byte, error)
GetPersonalizationValue() ([]byte, error)
GetInitialMeasurement() ([]byte, error)
GetExtensibleMeasurements() ([][]byte, error)
GetHashAlgID() (string, error)
GetPubKey() ([]byte, error)
GetPubKeyHashAlgID() (string, error)
GetProfile() (string, error)
// Setters
SetChallenge([]byte) error
SetPersonalizationValue([]byte) error
SetInitialMeasurement([]byte) error
SetExtensibleMeasurements([][]byte) error
SetHashAlgID(string) error
SetPubKey([]byte) error
SetPubKeyHashAlgID(string) error
}
IClaims provides a uniform interface for dealing with CCA realm claims
func DecodeAndValidateClaimsFromCBOR ¶
DecodeAndValidateClaimsFromCBOR unmarshals and validates CCA realm claims from provided CBOR data.
func DecodeAndValidateClaimsFromJSON ¶
DecodeAndValidateClaimsFromJSON unmarshals and validates CCA realm claims from provided JSON data.
func DecodeClaimsFromCBOR ¶
DecodeClaimsFromCBOR unmarshals CCA realm claims from provided CBOR data.
func DecodeClaimsFromJSON ¶
DecodeClaimsFromJSON unmarshals CCA realm claims from provided JSON data.