Documentation
¶
Overview ¶
Copyright 2023-2024 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Copyright 2024 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Copyright 2024 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Example (Profile_marshal) ¶
note: this example is rather verbose as we're going to be constructing a CoMID by hand. In practice, you would typically write a JSON document and then unmarshal that into a CoRIM before marshaling it into CBOR (in which case, extensions will work as with unmarshaling example above).
profileID, err := eat.NewProfile("http://example.com/example-profile")
if err != nil {
panic(err)
}
profile, ok := GetProfile(profileID)
if !ok {
log.Fatalf("profile %v not found", profileID)
}
myCorim := profile.GetUnsignedCorim()
myComid := profile.GetComid().
SetLanguage("en-GB").
SetTagIdentity("example", 0).
// Adding an entity to the Entities collection also registers
// profile's extensions
AddEntity("ACME Ltd.", &comid.TestRegID, comid.RoleCreator)
address := "123 Fake Street"
err = myComid.Entities.Values[0].Extensions.Set("Address", &address)
if err != nil {
log.Fatalf("could not set entity Address: %v", err)
}
refVal := comid.ValueTriple{
Environment: comid.Environment{
Class: comid.NewClassImplID(comid.TestImplID).
SetVendor("ACME Ltd.").
SetModel("RoadRunner 2.0"),
},
Measurements: *comid.NewMeasurements(),
}
measurement := comid.MustNewPSAMeasurement(
comid.MustCreatePSARefValID(
comid.TestSignerID, "BL", "5.0.5",
)).AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00})
// alternatively, we can add extensions to individual value before
// adding it to the collection. Note that because we're adding the
// extension directly to the measurement, we're using a different
// extension point, comid.ExtMval rather than comid.ExtReferenceValue,
// as a measurement doesn't know that its going to be part of reference
// value, and so is unaware of reference value extension points.
extMap := extensions.NewMap().Add(comid.ExtMval, &RefValExtensions{})
if err = measurement.Val.RegisterExtensions(extMap); err != nil {
log.Fatal("could not register refval extensions")
}
refVal.Measurements.Add(measurement)
myComid.Triples.AddReferenceValue(refVal)
err = myComid.Valid()
if err != nil {
log.Fatalf("comid validity: %v", err)
}
myCorim.AddComid(*myComid)
buf, err := myCorim.ToCBOR()
if err != nil {
log.Fatalf("could not encode CoRIM: %v", err)
}
fmt.Printf("corim: %v", hex.EncodeToString(buf))
Output: corim: a300f6018158d9d901faa40065656e2d474201a100676578616d706c650281a4006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c65028101206f3132332046616b652053747265657404a1008182a100a300d90258582061636d652d696d706c656d656e746174696f6e2d69642d303030303030303031016941434d45204c74642e026e526f616452756e6e657220322e3081a200d90259a30162424c0465352e302e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00037822687474703a2f2f6578616d706c652e636f6d2f6578616d706c652d70726f66696c65
Example (Profile_unmarshal) ¶
buf, err := os.ReadFile("testcases/unsigned-example-corim.cbor")
if err != nil {
log.Fatalf("could not read corim file: %v", err)
}
// UnmarshalUnsignedCorimFromCBOR will detect the profile and ensure
// the correct extensions are loaded before unmarshalling
extractedCorim, err := UnmarshalUnsignedCorimFromCBOR(buf)
if err != nil {
log.Fatalf("could not unmarshal corim: %v", err)
}
extractedComid, err := UnmarshalComidFromCBOR(
extractedCorim.Tags[0],
extractedCorim.Profile,
)
if err != nil {
log.Fatalf("could not unmarshal corim: %v", err)
}
fmt.Printf("Language: %s\n", *extractedComid.Language)
fmt.Printf("Entity: %s\n", *extractedComid.Entities.Values[0].Name)
fmt.Printf(" %s\n", extractedComid.Entities.Values[0].
Extensions.MustGetString("Address"))
fmt.Printf("Measurements:\n")
for _, m := range extractedComid.Triples.ReferenceValues.Values[0].Measurements.Values {
val := hex.EncodeToString((*m.Val.Digests)[0].HashValue)
tsInt := m.Val.Extensions.MustGetInt64("timestamp")
ts := time.Unix(tsInt, 0).UTC()
fmt.Printf(" %v taken at %s\n", val, ts.Format("2006-01-02T15:04:05"))
}
Output: Language: en-GB Entity: ACME Ltd. 123 Fake Street Measurements: 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 taken at 2024-07-12T11:03:10 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f taken at 2024-07-12T11:03:10 a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 taken at 2024-07-12T11:03:10
Index ¶
- Constants
- Variables
- func NewPublicKeyFromJWK(j []byte) (crypto.PublicKey, error)
- func NewSignerFromJWK(j []byte) (cose.Signer, error)
- func RegisterEntityNameType(tag uint64, factory IEntityNameFactory) error
- func RegisterProfile(id *eat.Profile, exts extensions.Map) error
- func RegisterRole(val int64, name string) error
- func UnmarshalComidFromCBOR(buf []byte, profileID *eat.Profile) (*comid.Comid, error)
- func UnregisterProfile(id *eat.Profile) bool
- func ValidProfile(p eat.Profile) error
- type Entities
- func (o *Entities) Add(val *Entity) *Entities
- func (o *Entities) GetExtensions() extensions.IMapValue
- func (o *Entities) IsEmpty() bool
- func (o Entities) MarshalCBOR() ([]byte, error)
- func (o Entities) MarshalJSON() ([]byte, error)
- func (o *Entities) RegisterExtensions(exts extensions.Map) error
- func (o *Entities) UnmarshalCBOR(data []byte) error
- func (o *Entities) UnmarshalJSON(data []byte) error
- func (o *Entities) Valid() error
- type Entity
- func (o *Entity) GetExtensions() extensions.IMapValue
- func (o Entity) MarshalCBOR() ([]byte, error)
- func (o Entity) MarshalJSON() ([]byte, error)
- func (o *Entity) RegisterExtensions(exts extensions.Map) error
- func (o *Entity) SetName(name any) *Entity
- func (o *Entity) SetRegID(uri string) *Entity
- func (o *Entity) SetRoles(roles ...Role) *Entity
- func (o *Entity) UnmarshalCBOR(data []byte) error
- func (o *Entity) UnmarshalJSON(data []byte) error
- func (o Entity) Valid() error
- type EntityName
- type Extensions
- type ICorimConstrainer
- type IEntityConstrainer
- type IEntityNameFactory
- type IEntityNameValue
- type ISignerConstrainer
- type Locator
- type Meta
- func (o *Meta) FromCBOR(data []byte) error
- func (o *Meta) FromJSON(data []byte) error
- func (o *Meta) RegisterExtensions(exts extensions.Map) error
- func (o *Meta) SetSigner(name string, uri *string) *Meta
- func (o *Meta) SetValidity(notAfter time.Time, notBefore *time.Time) *Meta
- func (o Meta) ToCBOR() ([]byte, error)
- func (o Meta) ToJSON() ([]byte, error)
- func (o Meta) Valid() error
- type Profile
- type Role
- type Roles
- type SignedCorim
- type Signer
- func (o *Signer) GetExtensions() extensions.IMapValue
- func (o Signer) MarshalCBOR() ([]byte, error)
- func (o Signer) MarshalJSON() ([]byte, error)
- func (o *Signer) RegisterExtensions(exts extensions.Map) error
- func (o *Signer) SetName(name string) *Signer
- func (o *Signer) SetURI(uri string) *Signer
- func (o *Signer) UnmarshalCBOR(data []byte) error
- func (o *Signer) UnmarshalJSON(data []byte) error
- func (o Signer) Valid() error
- type StringEntityName
- type Tag
- type UnsignedCorim
- func (o *UnsignedCorim) AddComid(c comid.Comid) *UnsignedCorim
- func (o *UnsignedCorim) AddCoswid(c swid.SoftwareIdentity) *UnsignedCorim
- func (o *UnsignedCorim) AddCots(c cots.ConciseTaStore) *UnsignedCorim
- func (o *UnsignedCorim) AddDependentRim(href string, thumbprint *swid.HashEntry) *UnsignedCorim
- func (o *UnsignedCorim) AddEntity(name string, regID *string, roles ...Role) *UnsignedCorim
- func (o *UnsignedCorim) FromCBOR(data []byte) error
- func (o *UnsignedCorim) FromJSON(data []byte) error
- func (o *UnsignedCorim) GetExtensions() extensions.IMapValue
- func (o UnsignedCorim) GetID() string
- func (o *UnsignedCorim) RegisterExtensions(exts extensions.Map) error
- func (o *UnsignedCorim) SetID(v interface{}) *UnsignedCorim
- func (o *UnsignedCorim) SetProfile(urlOrOID string) *UnsignedCorim
- func (o *UnsignedCorim) SetRimValidity(notAfter time.Time, notBefore *time.Time) *UnsignedCorim
- func (o UnsignedCorim) ToCBOR() ([]byte, error)
- func (o UnsignedCorim) ToJSON() ([]byte, error)
- func (o UnsignedCorim) Valid() error
- type Validity
Examples ¶
Constants ¶
const ( ExtUnsignedCorim extensions.Point = "UnsignedCorim" ExtEntity extensions.Point = "CorimEntity" ExtSigner extensions.Point = "Signer" )
Variables ¶
var ( CoswidTag = []byte{0xd9, 0x01, 0xf9} // 505() ComidTag = []byte{0xd9, 0x01, 0xfa} // 506() )
var ( ContentType = "application/rim+cbor" NoExternalData = []byte("") HeaderLabelCorimMeta = int64(8) )
var AllExtensionPoints = make(map[extensions.Point]bool) // populated inside init() below
AllExtensionPoints is a list of all valid extension.Point's
var ComidMapExtensionPoints = []extensions.Point{ comid.ExtComid, comid.ExtEntity, comid.ExtTriples, comid.ExtReferenceValue, comid.ExtReferenceValueFlags, comid.ExtEndorsedValue, comid.ExtEndorsedValueFlags, }
ComidMapExtensionPoints is a list of extension.Point's valid for a comid.Comid.
var SignedCorimMapExtensionPoints = []extensions.Point{ ExtSigner, ExtUnsignedCorim, ExtEntity, }
SignedCorimMapExtensionPoints is a list of extension.Point's valid for a SignedCorim.
var UnsignedCorimMapExtensionPoints = []extensions.Point{ ExtUnsignedCorim, ExtEntity, }
UnsignedCorimMapExtensionPoints is a list of extension.Point's valid for a UnsignedCorim.
Functions ¶
func RegisterEntityNameType ¶
func RegisterEntityNameType(tag uint64, factory IEntityNameFactory) error
RegisterEntityNameType registers a new IEntityNameValue implementation (created by the provided IEntityNameFactory) under the specified type name and CBOR tag.
func RegisterProfile ¶ added in v1.6.2
func RegisterProfile(id *eat.Profile, exts extensions.Map) error
RegisterProfile registers a set of extensions with the specified profile. If the profile has already been registered, or if the extensions are invalid, an error is returned.
func RegisterRole ¶
RegisterRole creates a new Role association between the provided value and name. An error is returned if either clashes with any of the existing roles.
func UnmarshalComidFromCBOR ¶ added in v1.6.2
UnmarshalComidFromCBOR unmarshals a comid.Comid from provided CBOR data. If there are extensions associated with the profile specified by the data, they will be registered with the comid.Comid before it is unmarshaled.
func UnregisterProfile ¶ added in v1.6.2
UnregisterProfile ensures there are no extensions registered for the specified profile ID. Returns true if extensions were previously registered and have been removed, and false otherwise.
func ValidProfile ¶
ValidProfile checks that the supplied profile is in one of the supported formats (i.e., URI or OID)
Types ¶
type Entities ¶
type Entities extensions.Collection[Entity, *Entity]
Entities is a container for Entity instances and their extensions. It is a thin wrapper around extensions.Collection.
func NewEntities ¶
func NewEntities() *Entities
func (*Entities) GetExtensions ¶ added in v1.6.2
func (o *Entities) GetExtensions() extensions.IMapValue
func (Entities) MarshalCBOR ¶ added in v1.6.2
func (Entities) MarshalJSON ¶ added in v1.6.2
func (*Entities) RegisterExtensions ¶ added in v1.6.2
func (o *Entities) RegisterExtensions(exts extensions.Map) error
func (*Entities) UnmarshalCBOR ¶ added in v1.6.2
func (*Entities) UnmarshalJSON ¶ added in v1.6.2
type Entity ¶
type Entity struct {
Name *EntityName `cbor:"0,keyasint" json:"name"`
RegID *comid.TaggedURI `cbor:"1,keyasint,omitempty" json:"regid,omitempty"`
Roles Roles `cbor:"2,keyasint" json:"roles"`
Extensions
}
Entity stores an entity-map capable of CBOR and JSON serializations.
func (*Entity) GetExtensions ¶
func (o *Entity) GetExtensions() extensions.IMapValue
GetExtensions returns pervisouosly registered extension
func (Entity) MarshalCBOR ¶
MarshalCBOR serializes to CBOR
func (Entity) MarshalJSON ¶
MarshalJSON serializes to JSON
func (*Entity) RegisterExtensions ¶
func (o *Entity) RegisterExtensions(exts extensions.Map) error
RegisterExtensions registers a struct as a collections of extensions
func (*Entity) SetName ¶ added in v1.6.2
SetName is used to set the EntityName field of Entity using supplied name
func (*Entity) UnmarshalCBOR ¶
UnmarshalCBOR deserializes from CBOR
func (*Entity) UnmarshalJSON ¶
UnmarshalJSON deserializes from JSON
type EntityName ¶
type EntityName struct {
Value IEntityNameValue
}
EntityName encapsulates the name of the associated Entity. The CoRIM specification only allows for text (string) name, but this may be extended by other specifications.
func MustNewEntityName ¶
func MustNewEntityName(val any, typ string) *EntityName
MustNewEntityName is like NewEntityName, except it doesn't return an error, assuming that the provided value is valid. It panics if that isn't the case.
func MustNewStringEntityName ¶
func MustNewStringEntityName(val any) *EntityName
func NewEntityName ¶
func NewEntityName(val any, typ string) (*EntityName, error)
NewEntityName creates a new EntityName of the specified type using the provided value.
func NewStringEntityName ¶
func NewStringEntityName(val any) (*EntityName, error)
func (EntityName) MarshalCBOR ¶
func (o EntityName) MarshalCBOR() ([]byte, error)
MarshalCBOR serializes the EntityName into CBOR-encoded bytes.
func (EntityName) MarshalJSON ¶
func (o EntityName) MarshalJSON() ([]byte, error)
MarshalJSON serializes the EntityName into a JSON object.
func (EntityName) String ¶
func (o EntityName) String() string
String returns the string representation of the EntityName
func (*EntityName) UnmarshalCBOR ¶
func (o *EntityName) UnmarshalCBOR(data []byte) error
UnmarshalCBOR deserializes the EntityName from CBOR-encoded bytes.
func (*EntityName) UnmarshalJSON ¶
func (o *EntityName) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes EntityName from the provided JSON object.
func (EntityName) Valid ¶
func (o EntityName) Valid() error
Valid returns nil if the underlying EntityName value is valid, or an error describing the problem otherwise.
type Extensions ¶
type Extensions struct {
extensions.Extensions
}
type ICorimConstrainer ¶
type ICorimConstrainer interface {
ConstrainCorim(*UnsignedCorim) error
}
type IEntityConstrainer ¶
type IEntityNameFactory ¶
type IEntityNameFactory func(any) (*EntityName, error)
IEntityNameFactory defines the signature for the factory functions that may be registred using RegisterEntityNameType to provide a new implementation of the corresponding type choice. The factory function should create a new *EntityName with the underlying value created based on the provided input. The range of valid inputs is up to the specific type choice implementation, however it _must_ accept nil as one of the inputs, and return the Zero value for implemented type. See also https://go.dev/ref/spec#The_zero_value
type IEntityNameValue ¶
type IEntityNameValue interface {
extensions.ITypeChoiceValue
}
IEntityNameValue is the interface implemented by all EntityName value types.
type ISignerConstrainer ¶
type Locator ¶
type Locator struct {
Href comid.TaggedURI `cbor:"0,keyasint" json:"href"`
Thumbprint *swid.HashEntry `cbor:"1,keyasint,omitempty" json:"thumbprint,omitempty"`
}
Locator is the internal representation of the corim-locator-map with CBOR and JSON serialization.
type Meta ¶
type Meta struct {
Signer Signer `cbor:"0,keyasint" json:"signer"`
Validity *Validity `cbor:"1,keyasint,omitempty" json:"validity,omitempty"`
}
Meta stores a corim-meta-map with JSON and CBOR serializations. It carries information about the CoRIM signer and, optionally, a validity period associated with the signed assertion. A corim-meta-map is serialized to CBOR and added to the protected header structure in the signed-corim as a byte string
func (*Meta) RegisterExtensions ¶ added in v1.6.2
func (o *Meta) RegisterExtensions(exts extensions.Map) error
func (*Meta) SetSigner ¶
SetSigner populates the Signer element in the target Meta with the supplied name and optional URI
func (*Meta) SetValidity ¶
SetValidity sets the validity period of the target Meta to the supplied time range
type Profile ¶ added in v1.6.2
type Profile struct {
ID *eat.Profile
MapExtensions extensions.Map
}
Profile associates an EAT profile ID with a set of extensions. It allows obtaining new CoRIM and CoMID structures that had associated extensions registered.
func GetProfile ¶ added in v1.6.2
GetProfile returns the Profile associated with the specified ID, or an empty profile if no Profile has been registered for the id. The second return value indicates whether a profile for the ID has been found.
func (*Profile) GetComid ¶ added in v1.6.2
GetComid returns a pointer to a new comid.Comid that had the Profile's extensions (if any) registered.
func (*Profile) GetSignedCorim ¶ added in v1.6.2
func (o *Profile) GetSignedCorim() *SignedCorim
GetSignedCorim returns a pointer to a new SignedCorim that had the Profile's extensions (if any) registered.
func (*Profile) GetUnsignedCorim ¶ added in v1.6.2
func (o *Profile) GetUnsignedCorim() *UnsignedCorim
GetUnsignedCorim returns a pointer to a new UnsignedCorim that had the Profile's extensions (if any) registered.
type Roles ¶
type Roles []Role
func (Roles) MarshalJSON ¶
func (*Roles) UnmarshalJSON ¶
type SignedCorim ¶
type SignedCorim struct {
UnsignedCorim UnsignedCorim
Meta Meta
// contains filtered or unexported fields
}
SignedCorim encodes a signed-corim message (i.e., a COSE Sign1 wrapped CoRIM) with signature and verification methods
func GetSignedCorim ¶ added in v1.6.2
func GetSignedCorim(profileID *eat.Profile) *SignedCorim
GetSingedCorim returns a pointer to a new SingedCorim instance. If there are extensions associated with the provided profileID, they will be registered with the instance.
func NewSignedCorim ¶ added in v1.6.2
func NewSignedCorim() *SignedCorim
NewSignedCorim instantiates an empty SignedCorim
func UnmarshalSignedCorimFromCBOR ¶ added in v1.6.2
func UnmarshalSignedCorimFromCBOR(buf []byte) (*SignedCorim, error)
UnmarshalSignedCorimFromCBOR unmarshals a SignedCorim from provided CBOR data. If there are extensions associated with the profile specified by the data, they will be registered with the UnsignedCorim before it is unmarshaled.
func (*SignedCorim) FromCOSE ¶
func (o *SignedCorim) FromCOSE(buf []byte) error
FromCOSE decodes and effects syntactic validation on the supplied signed-corim message, including the embedded unsigned-corim and corim-meta. On success, the unsigned-corim-map is made available via the UnsignedCorim field while the corim-meta-map is decoded into the Meta field.
func (*SignedCorim) RegisterExtensions ¶ added in v1.6.2
func (o *SignedCorim) RegisterExtensions(exts extensions.Map) error
type Signer ¶
type Signer struct {
Name string `cbor:"0,keyasint" json:"name"`
URI *comid.TaggedURI `cbor:"1,keyasint,omitempty" json:"uri,omitempty"`
Extensions
}
func (*Signer) GetExtensions ¶
func (o *Signer) GetExtensions() extensions.IMapValue
GetExtensions returns previously registered extension
func (Signer) MarshalCBOR ¶
MarshalCBOR serializes to CBOR
func (Signer) MarshalJSON ¶
MarshalJSON serializes to JSON
func (*Signer) RegisterExtensions ¶
func (o *Signer) RegisterExtensions(exts extensions.Map) error
RegisterExtensions registers a struct as a collections of extensions
func (*Signer) UnmarshalCBOR ¶
UnmarshalCBOR deserializes from CBOR
func (*Signer) UnmarshalJSON ¶
UnmarshalJSON deserializes from JSON
type StringEntityName ¶
type StringEntityName string
StringEntityName is a text string EntityName with no other contraints. This is the only EntityName value type defined by the CoRIM specification itself.
func (StringEntityName) String ¶
func (o StringEntityName) String() string
func (StringEntityName) Type ¶
func (o StringEntityName) Type() string
func (StringEntityName) Valid ¶
func (o StringEntityName) Valid() error
type UnsignedCorim ¶
type UnsignedCorim struct {
ID swid.TagID `cbor:"0,keyasint" json:"corim-id"`
// note: even though tags are mandatory for CoRIM, we allow omitting
// them in our JSON templates for cocli (the min template just has
// corim-id). Since we're never writing JSON (so far), this normally
// wouldn't matter, however the custom serialization code we use to
// handle embedded structs relies on the omitempty entry to determine
// if a field is optional, so we use it during unmarshaling as well as
// marshaling. Hence omitempty is present for the json tag, but not
// cbor.
Tags []Tag `cbor:"1,keyasint" json:"tags,omitempty"`
DependentRims *[]Locator `cbor:"2,keyasint,omitempty" json:"dependent-rims,omitempty"`
Profile *eat.Profile `cbor:"3,keyasint,omitempty" json:"profile,omitempty"`
RimValidity *Validity `cbor:"4,keyasint,omitempty" json:"validity,omitempty"`
Entities *Entities `cbor:"5,keyasint,omitempty" json:"entities,omitempty"`
Extensions
}
UnsignedCorim is the top-level representation of the unsigned-corim-map with CBOR and JSON serialization.
func GetUnsignedCorim ¶ added in v1.6.2
func GetUnsignedCorim(profileID *eat.Profile) *UnsignedCorim
GetUnsignedCorim returns a pointer to a new UnsignedCorim instance. If there are extensions associated with the provided profileID, they will be registered with the instance.
func NewUnsignedCorim ¶
func NewUnsignedCorim() *UnsignedCorim
NewUnsignedCorim instantiates an empty UnsignedCorim
func UnmarshalUnsignedCorimFromCBOR ¶ added in v1.6.2
func UnmarshalUnsignedCorimFromCBOR(buf []byte) (*UnsignedCorim, error)
UnmarshalUnsignedCorimFromCBOR unmarshals an UnsignedCorim from provided CBOR data. If there are extensions associated with the profile specified by the data, they will be registered with the UnsignedCorim before it is unmarshaled.
func UnmarshalUnsignedCorimFromJSON ¶ added in v1.6.2
func UnmarshalUnsignedCorimFromJSON(buf []byte) (*UnsignedCorim, error)
UnmarshalUnsignedCorimFromJSON unmarshals an UnsignedCorim from provided JSON data. If there are extensions associated with the profile specified by the data, they will be registered with the UnsignedCorim before it is unmarshaled.
func (*UnsignedCorim) AddComid ¶
func (o *UnsignedCorim) AddComid(c comid.Comid) *UnsignedCorim
AddComid appends the CBOR encoded (and appropriately tagged) CoMID to the tags array of the unsigned-corim-map
func (*UnsignedCorim) AddCoswid ¶
func (o *UnsignedCorim) AddCoswid(c swid.SoftwareIdentity) *UnsignedCorim
AddCoswid appends the CBOR encoded (and appropriately tagged) CoSWID to the tags array of the unsigned-corim-map
func (*UnsignedCorim) AddCots ¶
func (o *UnsignedCorim) AddCots(c cots.ConciseTaStore) *UnsignedCorim
AddCots appends the CBOR encoded (and appropriately tagged) CoTS to the tags array of the unsigned-corim-map
func (*UnsignedCorim) AddDependentRim ¶
func (o *UnsignedCorim) AddDependentRim(href string, thumbprint *swid.HashEntry) *UnsignedCorim
AddDependentRim creates a corim-locator-map from the supplied arguments and appends it to the dependent RIMs in the unsigned-corim-map
func (*UnsignedCorim) AddEntity ¶
func (o *UnsignedCorim) AddEntity(name string, regID *string, roles ...Role) *UnsignedCorim
AddEntity adds an organizational entity, together with the roles this entity claims with regards to the CoRIM, to the target UnsignerCorim. name is the entity name, regID is a URI that uniquely identifies the entity. For the moment, roles can only be RoleManifestCreator.
func (*UnsignedCorim) FromCBOR ¶
func (o *UnsignedCorim) FromCBOR(data []byte) error
FromCBOR deserializes a CBOR-encoded unsigned CoRIM into the target UnsignedCorim
func (*UnsignedCorim) FromJSON ¶
func (o *UnsignedCorim) FromJSON(data []byte) error
FromJSON deserializes a JSON-encoded unsigned CoRIM into the target UnsignedCorim
func (*UnsignedCorim) GetExtensions ¶
func (o *UnsignedCorim) GetExtensions() extensions.IMapValue
GetExtensions returns pervisouosly registered extension
func (UnsignedCorim) GetID ¶
func (o UnsignedCorim) GetID() string
GetID retrieves the corim-id from the unsigned-corim-map as a string
func (*UnsignedCorim) RegisterExtensions ¶
func (o *UnsignedCorim) RegisterExtensions(exts extensions.Map) error
RegisterExtensions registers a struct as a collections of extensions
func (*UnsignedCorim) SetID ¶
func (o *UnsignedCorim) SetID(v interface{}) *UnsignedCorim
SetID sets the corim-id in the unsigned-corim-map to the supplied value. The corim-id can be passed as UUID in string or binary form (i.e., byte array), or as a (non-empty) string
func (*UnsignedCorim) SetProfile ¶ added in v1.6.2
func (o *UnsignedCorim) SetProfile(urlOrOID string) *UnsignedCorim
SetProfile sets the supplied profile identifier (either a URL or OID) as the profile in the unsigned-corim-map
func (*UnsignedCorim) SetRimValidity ¶
func (o *UnsignedCorim) SetRimValidity(notAfter time.Time, notBefore *time.Time) *UnsignedCorim
SetRimValidity can be used to set the validity period of the CoRIM. The caller must supply a "not-after" timestamp and optionally a "not-before" timestamp.
func (UnsignedCorim) ToCBOR ¶
func (o UnsignedCorim) ToCBOR() ([]byte, error)
ToCBOR serializes the target unsigned CoRIM to CBOR
func (UnsignedCorim) ToJSON ¶ added in v1.6.2
func (o UnsignedCorim) ToJSON() ([]byte, error)
ToJSON serializes the target unsigned CoRIM to JSON
func (UnsignedCorim) Valid ¶
func (o UnsignedCorim) Valid() error
Valid checks the validity (according to the spec) of the target unsigned CoRIM
type Validity ¶
type Validity struct {
NotBefore *time.Time `cbor:"0,keyasint,omitempty" json:"not-before,omitempty"`
NotAfter time.Time `cbor:"1,keyasint" json:"not-after"`
}
func NewValidity ¶
func NewValidity() *Validity