Documentation ¶
Overview ¶
Example (Cca_refval) ¶
package main import "fmt" func main() { comid := Comid{} if err := comid.FromJSON([]byte(CCARefValJSONTemplate)); err != nil { panic(err) } if err := comid.Valid(); err != nil { panic(err) } if err := extractCcaRefVals(&comid); err != nil { panic(err) } } func extractCcaRefVals(c *Comid) error { if c.Triples.ReferenceValues == nil { return fmt.Errorf("no reference values triples") } for i, rv := range *c.Triples.ReferenceValues { if err := extractCCARefVal(rv); err != nil { return fmt.Errorf("bad PSA reference value at index %d: %w", i, err) } } return nil } func extractCCARefVal(rv ReferenceValue) error { class := rv.Environment.Class if err := extractImplementationID(class); err != nil { return fmt.Errorf("extracting impl-id: %w", err) } for i, m := range rv.Measurements { if m.Key == nil { return fmt.Errorf("missing mKey at index %d", i) } if !m.Key.IsSet() { return fmt.Errorf("mKey not set at index %d", i) } if m.Key.IsPSARefValID() { if err := extractSwMeasurement(m); err != nil { return fmt.Errorf("extracting measurement at index %d: %w", i, err) } } if m.Key.IsCCAPlatformConfigID() { if err := extractCCARefValID(m.Key); err != nil { return fmt.Errorf("extracting cca-refval-id: %w", err) } if err := extractRawValue(m.Val.RawValue); err != nil { return fmt.Errorf("extracting raw vlue: %w", err) } return nil } } return nil } func extractRawValue(r *RawValue) error { if r == nil { return fmt.Errorf("no raw value") } b, err := r.GetBytes() if err != nil { return fmt.Errorf("failed to extract raw value bytes") } fmt.Printf("Raw value: %x\n", b) return nil } func extractCCARefValID(k *Mkey) error { if k == nil { return fmt.Errorf("no measurement key") } id, err := k.GetCCAPlatformConfigID() if err != nil { return fmt.Errorf("getting CCA platform config id: %w", err) } fmt.Printf("Label: %s\n", id) return nil }
Output: ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b Label: BL Version: 2.1.0 Digest: 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b Label: PRoT Version: 1.3.5 Digest: 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b Label: ARoT Version: 0.1.4 Digest: a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 Label: a non-empty (unique) label Raw value: 72617776616c75650a72617776616c75650a
Example (Decode_CBOR_1) ¶
// https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-1.diag in := []byte{ 0xa3, 0x01, 0xa1, 0x00, 0x50, 0x3f, 0x06, 0xaf, 0x63, 0xa9, 0x3c, 0x11, 0xe4, 0x97, 0x97, 0x00, 0x50, 0x56, 0x90, 0x77, 0x3f, 0x02, 0x81, 0xa3, 0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x01, 0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x81, 0x00, 0x04, 0xa1, 0x00, 0x81, 0x82, 0xa1, 0x00, 0xa4, 0x00, 0xd8, 0x25, 0x50, 0x67, 0xb2, 0x8b, 0x6c, 0x34, 0xcc, 0x40, 0xa1, 0x91, 0x17, 0xab, 0x5b, 0x05, 0x91, 0x1e, 0x37, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x6f, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x52, 0x6f, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x03, 0x01, 0x81, 0xa1, 0x01, 0xa2, 0x00, 0xa2, 0x00, 0x65, 0x31, 0x2e, 0x30, 0x2e, 0x30, 0x01, 0x19, 0x40, 0x00, 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0x44, 0xaa, 0x33, 0x6a, 0xf4, 0xcb, 0x14, 0xa8, 0x79, 0x43, 0x2e, 0x53, 0xdd, 0x65, 0x71, 0xc7, 0xfa, 0x9b, 0xcc, 0xaf, 0xb7, 0x5f, 0x48, 0x82, 0x59, 0x26, 0x2d, 0x6e, 0xa3, 0xa4, 0xd9, 0x1b, } comid := Comid{} err := comid.FromCBOR(in) if err != nil { fmt.Printf("FAIL: %v", err) } else { fmt.Println("OK") }
Output: OK
Example (Decode_CBOR_2) ¶
// https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-2.diag in := []byte{ 0xa3, 0x01, 0xa1, 0x00, 0x50, 0x3f, 0x06, 0xaf, 0x63, 0xa9, 0x3c, 0x11, 0xe4, 0x97, 0x97, 0x00, 0x50, 0x56, 0x90, 0x77, 0x3f, 0x02, 0x81, 0xa3, 0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x01, 0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x81, 0x00, 0x04, 0xa2, 0x00, 0x83, 0x82, 0xa1, 0x00, 0xa4, 0x00, 0xd8, 0x25, 0x50, 0x67, 0xb2, 0x8b, 0x6c, 0x34, 0xcc, 0x40, 0xa1, 0x91, 0x17, 0xab, 0x5b, 0x05, 0x91, 0x1e, 0x37, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x78, 0x18, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x52, 0x6f, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x03, 0x01, 0x81, 0xa1, 0x01, 0xa1, 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0x44, 0xaa, 0x33, 0x6a, 0xf4, 0xcb, 0x14, 0xa8, 0x79, 0x43, 0x2e, 0x53, 0xdd, 0x65, 0x71, 0xc7, 0xfa, 0x9b, 0xcc, 0xaf, 0xb7, 0x5f, 0x48, 0x82, 0x59, 0x26, 0x2d, 0x6e, 0xa3, 0xa4, 0xd9, 0x1b, 0x82, 0xa1, 0x00, 0xa5, 0x00, 0xd8, 0x25, 0x50, 0xa7, 0x1b, 0x3e, 0x38, 0x8d, 0x45, 0x4a, 0x05, 0x81, 0xf3, 0x52, 0xe5, 0x8c, 0x83, 0x2c, 0x5c, 0x01, 0x6a, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x77, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, 0x43, 0x6f, 0x79, 0x6f, 0x74, 0x65, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x53, 0x03, 0x02, 0x04, 0x00, 0x81, 0xa1, 0x01, 0xa1, 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0xbb, 0x71, 0x19, 0x8e, 0xd6, 0x0a, 0x95, 0xdc, 0x3c, 0x61, 0x9e, 0x55, 0x5c, 0x2c, 0x0b, 0x8d, 0x75, 0x64, 0xa3, 0x80, 0x31, 0xb0, 0x34, 0xa1, 0x95, 0x89, 0x25, 0x91, 0xc6, 0x53, 0x65, 0xb0, 0x82, 0xa1, 0x00, 0xa5, 0x00, 0xd8, 0x25, 0x50, 0xa7, 0x1b, 0x3e, 0x38, 0x8d, 0x45, 0x4a, 0x05, 0x81, 0xf3, 0x52, 0xe5, 0x8c, 0x83, 0x2c, 0x5c, 0x01, 0x6a, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x77, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, 0x43, 0x6f, 0x79, 0x6f, 0x74, 0x65, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x65, 0x64, 0x20, 0x4f, 0x53, 0x03, 0x02, 0x04, 0x01, 0x81, 0xa1, 0x01, 0xa1, 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0xbb, 0x71, 0x19, 0x8e, 0xd6, 0x0a, 0x95, 0xdc, 0x3c, 0x61, 0x9e, 0x55, 0x5c, 0x2c, 0x0b, 0x8d, 0x75, 0x64, 0xa3, 0x80, 0x31, 0xb0, 0x34, 0xa1, 0x95, 0x89, 0x25, 0x91, 0xc6, 0x53, 0x65, 0xb0, 0x01, 0x81, 0x82, 0xa1, 0x00, 0xa4, 0x00, 0xd8, 0x25, 0x50, 0x67, 0xb2, 0x8b, 0x6c, 0x34, 0xcc, 0x40, 0xa1, 0x91, 0x17, 0xab, 0x5b, 0x05, 0x91, 0x1e, 0x37, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x72, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x52, 0x6f, 0x6f, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x03, 0x00, 0x81, 0xa1, 0x01, 0xa1, 0x01, 0xd9, 0x02, 0x28, 0x01, } comid := Comid{} err := comid.FromCBOR(in) if err != nil { fmt.Printf("FAIL: %v", err) } else { fmt.Println("OK") }
Output: OK
Example (Decode_CBOR_3) ¶
// https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-design-cd.diag in := []byte{ 0xa4, 0x01, 0xa1, 0x00, 0x50, 0x1e, 0xac, 0xd5, 0x96, 0xf4, 0xa3, 0x4f, 0xb6, 0x99, 0xbf, 0xae, 0xb5, 0x8e, 0x0a, 0x4e, 0x47, 0x02, 0x81, 0xa3, 0x00, 0x71, 0x46, 0x50, 0x47, 0x41, 0x20, 0x44, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x2d, 0x52, 0x2d, 0x55, 0x73, 0x01, 0xd8, 0x20, 0x78, 0x1e, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x81, 0x00, 0x03, 0x81, 0xa2, 0x00, 0x50, 0x97, 0xf5, 0xa7, 0x07, 0x1c, 0x6f, 0x43, 0x8f, 0x87, 0x7a, 0x4a, 0x02, 0x07, 0x80, 0xeb, 0xe9, 0x01, 0x00, 0x04, 0xa2, 0x00, 0x84, 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x4b, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x01, 0x01, 0x76, 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x02, 0x81, 0xa1, 0x01, 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x48, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x4b, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x02, 0x01, 0x76, 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x02, 0x81, 0xa1, 0x01, 0xa1, 0x02, 0x81, 0x82, 0x07, 0x58, 0x30, 0x3f, 0xe1, 0x8e, 0xca, 0x40, 0x53, 0x87, 0x9e, 0x01, 0x7e, 0xf5, 0xeb, 0x7a, 0x3e, 0x51, 0x57, 0x65, 0x9c, 0x5f, 0x9b, 0xb1, 0x5b, 0x7d, 0x09, 0x95, 0x9b, 0x8b, 0x86, 0x47, 0x82, 0x2a, 0x4c, 0xc2, 0x1c, 0x3a, 0xa6, 0x72, 0x1c, 0xef, 0x87, 0xf5, 0xbf, 0xa5, 0x34, 0x95, 0xdb, 0x08, 0x33, 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x4b, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x03, 0x01, 0x76, 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x02, 0x81, 0xa1, 0x01, 0xa1, 0x02, 0x81, 0x82, 0x07, 0x58, 0x30, 0x20, 0xff, 0x68, 0x1a, 0x08, 0x82, 0xe2, 0x9b, 0x48, 0x19, 0x53, 0x88, 0x89, 0x36, 0x20, 0x9c, 0xb5, 0x3d, 0xf9, 0xc5, 0xaa, 0xec, 0x60, 0x6a, 0x2c, 0x24, 0xa0, 0xfb, 0x13, 0x85, 0x95, 0x12, 0x4b, 0x8e, 0x3f, 0x24, 0xa1, 0x27, 0x71, 0xbc, 0x38, 0x54, 0xcc, 0x68, 0xb4, 0x03, 0x61, 0xad, 0x82, 0xa1, 0x00, 0xa2, 0x00, 0xd8, 0x6f, 0x4c, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x63, 0x01, 0x01, 0x76, 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x81, 0xa1, 0x01, 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x58, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x58, 0x30, 0x46, 0x62, 0x24, 0x34, 0x3d, 0x68, 0x18, 0x02, 0xc1, 0x50, 0x6b, 0xbe, 0xd7, 0xd7, 0xf0, 0x0b, 0x96, 0x9b, 0xad, 0xdd, 0x63, 0x46, 0xe4, 0xf2, 0xe7, 0xce, 0x14, 0x66, 0x92, 0x99, 0x6f, 0x22, 0xa4, 0x58, 0x14, 0xde, 0x81, 0xd2, 0x48, 0xf5, 0x83, 0xb6, 0x5f, 0x81, 0x7b, 0x5f, 0xce, 0xab, 0x01, 0x81, 0x82, 0xa1, 0x00, 0xa2, 0x00, 0xd8, 0x6f, 0x4c, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x63, 0x02, 0x01, 0x76, 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x81, 0xa1, 0x01, 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x48, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, } comid := Comid{} err := comid.FromCBOR(in) if err != nil { fmt.Printf("FAIL: %v", err) } else { fmt.Println("OK") }
Output: OK
Example (Decode_CBOR_4) ¶
// https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-firmware-cd.diag in := []byte{ 0xa3, 0x01, 0xa1, 0x00, 0x50, 0xaf, 0x1c, 0xd8, 0x95, 0xbe, 0x78, 0x4a, 0xdb, 0xb7, 0xe9, 0xad, 0xd4, 0x4a, 0x65, 0xab, 0xf3, 0x02, 0x81, 0xa3, 0x00, 0x71, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x20, 0x4d, 0x46, 0x47, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x01, 0xd8, 0x20, 0x78, 0x18, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x66, 0x77, 0x6d, 0x66, 0x67, 0x69, 0x6e, 0x63, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x81, 0x00, 0x04, 0xa2, 0x00, 0x82, 0x82, 0xa1, 0x00, 0xa4, 0x01, 0x70, 0x66, 0x77, 0x6d, 0x66, 0x67, 0x69, 0x6e, 0x63, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x67, 0x66, 0x77, 0x59, 0x5f, 0x6e, 0x35, 0x78, 0x03, 0x00, 0x04, 0x00, 0x81, 0xa1, 0x01, 0xa2, 0x01, 0xd9, 0x02, 0x28, 0x01, 0x02, 0x81, 0x82, 0x07, 0x58, 0x30, 0x15, 0xe7, 0x7d, 0x6f, 0x13, 0x32, 0x52, 0xf1, 0xdb, 0x70, 0x44, 0x90, 0x13, 0x13, 0x88, 0x4f, 0x29, 0x77, 0xd2, 0x10, 0x9b, 0x33, 0xc7, 0x9f, 0x33, 0xe0, 0x79, 0xbf, 0xc7, 0x88, 0x65, 0x25, 0x5c, 0x0f, 0xb7, 0x33, 0xc2, 0x40, 0xfd, 0xda, 0x54, 0x4b, 0x82, 0x15, 0xd7, 0xb8, 0xf8, 0x15, 0x82, 0xa1, 0x00, 0xa4, 0x01, 0x70, 0x66, 0x77, 0x6d, 0x66, 0x67, 0x69, 0x6e, 0x63, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x67, 0x66, 0x77, 0x58, 0x5f, 0x6e, 0x35, 0x78, 0x03, 0x01, 0x04, 0x00, 0x81, 0xa1, 0x01, 0xa2, 0x01, 0xd9, 0x02, 0x28, 0x01, 0x02, 0x81, 0x82, 0x07, 0x58, 0x30, 0x3d, 0x90, 0xb6, 0xbf, 0x00, 0x3d, 0xa2, 0xd9, 0x4e, 0xa5, 0x46, 0x3f, 0x97, 0xfb, 0x3c, 0x53, 0xdd, 0xc5, 0x1c, 0xfb, 0xa1, 0xe3, 0xe3, 0x8e, 0xef, 0x7a, 0xf0, 0x71, 0xa6, 0x79, 0x86, 0x59, 0x5d, 0x22, 0x72, 0x91, 0x31, 0xdf, 0x9f, 0xe8, 0x0f, 0x54, 0x51, 0xee, 0xf1, 0x54, 0xf8, 0x5e, 0x01, 0x81, 0x82, 0xa1, 0x00, 0xa2, 0x00, 0xd8, 0x6f, 0x4c, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x63, 0x01, 0x01, 0x70, 0x66, 0x77, 0x6d, 0x66, 0x67, 0x69, 0x6e, 0x63, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x81, 0xa1, 0x01, 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x48, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, } comid := Comid{} err := comid.FromCBOR(in) if err != nil { fmt.Printf("FAIL: %v", err) } else { fmt.Println("OK") }
Output: OK
Example (Decode_CBOR_5) ¶
// Taken from https://github.com/ietf-corim-cddl/blob/main/examples/comid-3.diag in := []byte{ 0xa3, 0x01, 0xa1, 0x00, 0x78, 0x20, 0x6d, 0x79, 0x2d, 0x6e, 0x73, 0x3a, 0x61, 0x63, 0x6d, 0x65, 0x2d, 0x72, 0x6f, 0x61, 0x64, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x2d, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x02, 0x81, 0xa3, 0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x01, 0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x83, 0x01, 0x00, 0x02, 0x04, 0xa1, 0x00, 0x81, 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x44, 0x55, 0x02, 0xc0, 0x00, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x78, 0x18, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x52, 0x6f, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x81, 0xa2, 0x00, 0x19, 0x02, 0xbc, 0x01, 0xa1, 0x02, 0x81, 0x82, 0x06, 0x44, 0xab, 0xcd, 0xef, 0x00, } comid := Comid{} err := comid.FromCBOR(in) if err != nil { fmt.Printf("FAIL: %v", err) } else { fmt.Println("OK") }
Output: OK
Example (Decode_JSON) ¶
j := ` { "lang": "en-GB", "tag-identity": { "id": "43BBE37F-2E61-4B33-AED3-53CFF1428B16", "version": 1 }, "entities": [ { "name": "ACME Ltd.", "regid": "https://acme.example", "roles": [ "tagCreator" ] }, { "name": "EMCA Ltd.", "regid": "https://emca.example", "roles": [ "maintainer", "creator" ] } ], "linked-tags": [ { "target": "6F7D8D2F-EAEC-4A15-BB46-1E4DCB85DDFF", "rel": "replaces" } ], "triples": { "reference-values": [ { "environment": { "class": { "id": { "type": "uuid", "value": "83294297-97EB-42EF-8A72-AE9FEA002750" }, "vendor": "ACME", "model": "RoadRunner Boot ROM", "layer": 0, "index": 0 }, "instance": { "type": "ueid", "value": "Ad6tvu/erb7v3q2+796tvu8=" } }, "measurements": [ { "value": { "digests": [ "sha-256:3q2+7w==" ] } } ] }, { "environment": { "class": { "id": { "type": "psa.impl-id", "value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE=" }, "vendor": "PSA-X", "model": "Turbo PRoT" } }, "measurements": [ { "key": { "type": "psa.refval-id", "value": { "label": "PRoT", "version": "1.3.5", "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" } }, "value": { "digests": [ "sha-256:3q2+7w==" ], "svn": { "type": "exact-value", "value": 1 }, "mac-addr": "00:00:5e:00:53:01" } } ] } ], "endorsed-values": [ { "environment": { "class": { "id": { "type": "oid", "value": "2.16.840.1.101.3.4.2.1" } }, "instance": { "type": "uuid", "value": "9090B8D3-3B17-474C-A0B9-6F54731CAB72" } }, "measurements": [ { "value": { "mac-addr": "00:00:5e:00:53:01", "ip-addr": "2001:4860:0:2001::68", "serial-number": "C02X70VHJHD5", "ueid": "Ad6tvu/erb7v3q2+796tvu8=", "uuid": "9090B8D3-3B17-474C-A0B9-6F54731CAB72", "raw-value": { "type": "bytes", "value": "cmF3dmFsdWUKcmF3dmFsdWUK" }, "raw-value-mask": "qg==", "op-flags": [ "notSecure" ], "digests": [ "sha-256;5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXU=", "sha-384;S1bPoH+usqtX3pIeSpfWVRRLVGRw66qrb3HA21GN31tKX7KPsq0bSTQmRCTrHlqG" ], "version": { "scheme": "semaver", "value": "1.2.3beta4" }, "svn": { "type": "min-value", "value": 10 } } } ] } ], "attester-verification-keys": [ { "environment": { "group": { "type": "uuid", "value": "83294297-97EB-42EF-8A72-AE9FEA002750" } }, "verification-keys": [ { "type": "pkix-base64-key", "value": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----" } ] } ], "dev-identity-keys": [ { "environment": { "instance": { "type": "uuid", "value": "4ECCE47C-85F2-4FD9-9EC6-00DEB72DA707" } }, "verification-keys": [ { "type": "pkix-base64-key", "value": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----" }, { "type": "pkix-base64-key", "value": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----" } ] } ] } } ` comid := Comid{} err := comid.FromJSON([]byte(j)) if err != nil { fmt.Printf("FAIL: %v", err) } else { fmt.Println("OK") }
Output: OK
Example (Encode) ¶
comid := NewComid(). SetLanguage("en-GB"). SetTagIdentity("my-ns:acme-roadrunner-supplement", 0). AddEntity("ACME Ltd.", &TestRegID, RoleCreator, RoleTagCreator). AddEntity("EMCA Ltd.", nil, RoleMaintainer). AddLinkedTag("my-ns:acme-roadrunner-base", RelSupplements). AddLinkedTag("my-ns:acme-roadrunner-old", RelReplaces). AddReferenceValue( ReferenceValue{ Environment: Environment{ Class: NewClassOID(TestOID). SetVendor("ACME Ltd."). SetModel("RoadRunner"). SetLayer(0). SetIndex(1), Instance: NewInstanceUEID(TestUEID), Group: NewGroupUUID(TestUUID), }, Measurements: *NewMeasurements(). AddMeasurement( NewMeasurement(). SetKeyUUID(TestUUID). SetRawValueBytes([]byte{0x01, 0x02, 0x03, 0x04}, []byte{0xff, 0xff, 0xff, 0xff}). SetSVN(2). AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}). AddDigest(swid.Sha256_32, []byte{0xff, 0xff, 0xff, 0xff}). SetOpFlags(OpFlagNotSecure, OpFlagDebug). SetSerialNumber("C02X70VHJHD5"). SetUEID(TestUEID). SetUUID(TestUUID). SetMACaddr(MACaddr(TestMACaddr)). SetIPaddr(TestIPaddr), ), }, ). AddEndorsedValue( EndorsedValue{ Environment: Environment{ Class: NewClassUUID(TestUUID). SetVendor("ACME Ltd."). SetModel("RoadRunner"). SetLayer(0). SetIndex(1), Instance: NewInstanceUEID(TestUEID), Group: NewGroupUUID(TestUUID), }, Measurements: *NewMeasurements(). AddMeasurement( NewMeasurement(). SetKeyUUID(TestUUID). SetRawValueBytes([]byte{0x01, 0x02, 0x03, 0x04}, []byte{0xff, 0xff, 0xff, 0xff}). SetMinSVN(2). AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}). AddDigest(swid.Sha256_32, []byte{0xff, 0xff, 0xff, 0xff}). SetOpFlags(OpFlagNotSecure, OpFlagDebug, OpFlagNotConfigured). SetSerialNumber("C02X70VHJHD5"). SetUEID(TestUEID). SetUUID(TestUUID). SetMACaddr(MACaddr(TestMACaddr)). SetIPaddr(TestIPaddr), ), }, ). AddAttestVerifKey( AttestVerifKey{ Environment: Environment{ Instance: NewInstanceUUID(uuid.UUID(TestUUID)), }, VerifKeys: *NewCryptoKeys(). Add( MustNewPKIXBase64Key(TestECPubKey), ), }, ).AddDevIdentityKey( DevIdentityKey{ Environment: Environment{ Instance: NewInstanceUEID(TestUEID), }, VerifKeys: *NewCryptoKeys(). Add( MustNewPKIXBase64Key(TestECPubKey), ), }, ) cbor, err := comid.ToCBOR() if err == nil { fmt.Printf("%x\n", cbor) } json, err := comid.ToJSON() if err == nil { fmt.Printf("%s\n", string(json)) }
Output: a50065656e2d474201a10078206d792d6e733a61636d652d726f616472756e6e65722d737570706c656d656e740282a3006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c6502820100a20069454d4341204c74642e0281020382a200781a6d792d6e733a61636d652d726f616472756e6e65722d626173650100a20078196d792d6e733a61636d652d726f616472756e6e65722d6f6c64010104a4008182a300a500d86f445502c000016941434d45204c74642e026a526f616452756e6e65720300040101d902264702deadbeefdead02d8255031fb5abf023e4992aa4e95f9c1503bfa81a200d8255031fb5abf023e4992aa4e95f9c1503bfa01aa01d90228020282820644abcdef00820644ffffffff030a04d9023044010203040544ffffffff064802005e1000000001075020010db8000000000000000000000068086c43303258373056484a484435094702deadbeefdead0a5031fb5abf023e4992aa4e95f9c1503bfa018182a300a500d8255031fb5abf023e4992aa4e95f9c1503bfa016941434d45204c74642e026a526f616452756e6e65720300040101d902264702deadbeefdead02d8255031fb5abf023e4992aa4e95f9c1503bfa81a200d8255031fb5abf023e4992aa4e95f9c1503bfa01aa01d90229020282820644abcdef00820644ffffffff030b04d9023044010203040544ffffffff064802005e1000000001075020010db8000000000000000000000068086c43303258373056484a484435094702deadbeefdead0a5031fb5abf023e4992aa4e95f9c1503bfa028182a101d8255031fb5abf023e4992aa4e95f9c1503bfa81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d038182a101d902264702deadbeefdead81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d {"lang":"en-GB","tag-identity":{"id":"my-ns:acme-roadrunner-supplement"},"entities":[{"name":"ACME Ltd.","regid":"https://acme.example","roles":["creator","tagCreator"]},{"name":"EMCA Ltd.","roles":["maintainer"]}],"linked-tags":[{"target":"my-ns:acme-roadrunner-base","rel":"supplements"},{"target":"my-ns:acme-roadrunner-old","rel":"replaces"}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"oid","value":"2.5.2.8192"},"vendor":"ACME Ltd.","model":"RoadRunner","layer":0,"index":1},"instance":{"type":"ueid","value":"At6tvu/erQ=="},"group":{"type":"ueid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"measurements":[{"key":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"value":{"svn":{"type":"exact-value","value":2},"digests":["sha-256-32;q83vAA==","sha-256-32;/////w=="],"op-flags":["notSecure","debug"],"raw-value":{"type":"bytes","value":"AQIDBA=="},"raw-value-mask":"/////w==","mac-addr":"02:00:5e:10:00:00:00:01","ip-addr":"2001:db8::68","serial-number":"C02X70VHJHD5","ueid":"At6tvu/erQ==","uuid":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}}]}],"endorsed-values":[{"environment":{"class":{"id":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"vendor":"ACME Ltd.","model":"RoadRunner","layer":0,"index":1},"instance":{"type":"ueid","value":"At6tvu/erQ=="},"group":{"type":"ueid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"measurements":[{"key":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"value":{"svn":{"type":"min-value","value":2},"digests":["sha-256-32;q83vAA==","sha-256-32;/////w=="],"op-flags":["notConfigured","notSecure","debug"],"raw-value":{"type":"bytes","value":"AQIDBA=="},"raw-value-mask":"/////w==","mac-addr":"02:00:5e:10:00:00:00:01","ip-addr":"2001:db8::68","serial-number":"C02X70VHJHD5","ueid":"At6tvu/erQ==","uuid":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}}]}],"attester-verification-keys":[{"environment":{"instance":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}],"dev-identity-keys":[{"environment":{"instance":{"type":"ueid","value":"At6tvu/erQ=="}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}]}}
Example (Encode_PSA) ¶
comid := NewComid(). SetTagIdentity("my-ns:acme-roadrunner-supplement", 0). AddEntity("ACME Ltd.", &TestRegID, RoleCreator, RoleTagCreator, RoleMaintainer). AddReferenceValue( ReferenceValue{ Environment: Environment{ Class: NewClassImplID(TestImplID). SetVendor("ACME Ltd."). SetModel("RoadRunner 2.0"), }, Measurements: *NewMeasurements(). AddMeasurement( NewPSAMeasurement( *NewPSARefValID(TestSignerID). SetLabel("BL"). SetVersion("5.0.5"), ).AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}), ). AddMeasurement( NewPSAMeasurement( *NewPSARefValID(TestSignerID). SetLabel("PRoT"). SetVersion("1.3.5"), ).AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}), ), }, ). AddAttestVerifKey( AttestVerifKey{ Environment: Environment{ Instance: NewInstanceUEID(TestUEID), }, VerifKeys: *NewCryptoKeys(). Add( MustNewPKIXBase64Key(TestECPubKey), ), }, ) cbor, err := comid.ToCBOR() if err == nil { fmt.Printf("%x\n", cbor) } json, err := comid.ToJSON() if err == nil { fmt.Printf("%s\n", string(json)) }
Output: a301a10078206d792d6e733a61636d652d726f616472756e6e65722d737570706c656d656e740281a3006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c65028301000204a2008182a100a300d90258582061636d652d696d706c656d656e746174696f6e2d69642d303030303030303031016941434d45204c74642e026e526f616452756e6e657220322e3082a200d90259a30162424c0465352e302e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00a200d90259a3016450526f540465312e332e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00028182a101d902264702deadbeefdead81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d {"tag-identity":{"id":"my-ns:acme-roadrunner-supplement"},"entities":[{"name":"ACME Ltd.","regid":"https://acme.example","roles":["creator","tagCreator","maintainer"]}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"psa.impl-id","value":"YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE="},"vendor":"ACME Ltd.","model":"RoadRunner 2.0"}},"measurements":[{"key":{"type":"psa.refval-id","value":{"label":"BL","version":"5.0.5","signer-id":"rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="}},"value":{"digests":["sha-256-32;q83vAA=="]}},{"key":{"type":"psa.refval-id","value":{"label":"PRoT","version":"1.3.5","signer-id":"rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="}},"value":{"digests":["sha-256-32;q83vAA=="]}}]}],"attester-verification-keys":[{"environment":{"instance":{"type":"ueid","value":"At6tvu/erQ=="}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}]}}
Example (Encode_PSA_attestation_verification) ¶
comid := NewComid(). SetTagIdentity("my-ns:acme-roadrunner-supplement", 0). AddEntity("ACME Ltd.", &TestRegID, RoleCreator, RoleTagCreator, RoleMaintainer). AddAttestVerifKey( AttestVerifKey{ Environment: Environment{ Instance: NewInstanceUEID(TestUEID), }, VerifKeys: *NewCryptoKeys(). Add( MustNewPKIXBase64Key(TestECPubKey), ), }, ) cbor, err := comid.ToCBOR() if err == nil { fmt.Printf("%x\n", cbor) } json, err := comid.ToJSON() if err == nil { fmt.Printf("%s", string(json)) }
Output: a301a10078206d792d6e733a61636d652d726f616472756e6e65722d737570706c656d656e740281a3006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c65028301000204a1028182a101d902264702deadbeefdead81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d {"tag-identity":{"id":"my-ns:acme-roadrunner-supplement"},"entities":[{"name":"ACME Ltd.","regid":"https://acme.example","roles":["creator","tagCreator","maintainer"]}],"triples":{"attester-verification-keys":[{"environment":{"instance":{"type":"ueid","value":"At6tvu/erQ=="}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}]}}
Example (Psa_keys) ¶
package main import "fmt" func main() { comid := Comid{} if err := comid.FromJSON([]byte(PSAKeysJSONTemplate)); err != nil { panic(err) } if err := comid.Valid(); err != nil { panic(err) } if err := extractKeys(&comid); err != nil { panic(err) } } func extractKeys(c *Comid) error { if c.Triples.AttestVerifKeys == nil { return fmt.Errorf("no reference values triples") } for i, k := range *c.Triples.AttestVerifKeys { if err := extractPSAKey(k); err != nil { return fmt.Errorf("bad PSA verification key value at index %d: %w", i, err) } } return nil } func extractPSAKey(k AttestVerifKey) error { class := k.Environment.Class if err := extractImplementationID(class); err != nil { return fmt.Errorf("extracting impl-id: %w", err) } instance := k.Environment.Instance if err := extractInstanceID(instance); err != nil { return fmt.Errorf("extracting inst-id: %w", err) } if len(k.VerifKeys) != 1 { return fmt.Errorf("more than one key") } fmt.Printf("IAK public key: %x\n", k.VerifKeys[0]) return nil } func extractInstanceID(i *Instance) error { if i == nil { return fmt.Errorf("no instance") } instID, err := i.GetUEID() if err != nil { return fmt.Errorf("extracting implemenetation-id: %w", err) } fmt.Printf("InstanceID: %x\n", instID) return nil }
Output: ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 InstanceID: 01ceebae7b8927a3227e5303cf5e0f1f7b34bb542ad7250ac03fbcde36ec2f1508 IAK public key: 2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 InstanceID: 014ca3e4f50bf248c39787020d68ffd05c88767751bf2645ca923f57a98becd296 IAK public key: 2d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d
Example (Psa_refval) ¶
package main import "fmt" func main() { comid := Comid{} if err := comid.FromJSON([]byte(PSARefValJSONTemplate)); err != nil { panic(err) } if err := comid.Valid(); err != nil { panic(err) } if err := extractRefVals(&comid); err != nil { panic(err) } } func extractRefVals(c *Comid) error { if c.Triples.ReferenceValues == nil { return fmt.Errorf("no reference values triples") } for i, rv := range *c.Triples.ReferenceValues { if err := extractPSARefVal(rv); err != nil { return fmt.Errorf("bad PSA reference value at index %d: %w", i, err) } } return nil } func extractPSARefVal(rv ReferenceValue) error { class := rv.Environment.Class if err := extractImplementationID(class); err != nil { return fmt.Errorf("extracting impl-id: %w", err) } measurements := rv.Measurements if err := extractSwMeasurements(measurements); err != nil { return fmt.Errorf("extracting measurements: %w", err) } return nil } func extractSwMeasurements(m Measurements) error { if len(m) == 0 { return fmt.Errorf("no measurements") } for i, m := range m { if err := extractSwMeasurement(m); err != nil { return fmt.Errorf("extracting measurement at index %d: %w", i, err) } } return nil } func extractSwMeasurement(m Measurement) error { if err := extractPSARefValID(m.Key); err != nil { return fmt.Errorf("extracting PSA refval id: %w", err) } if err := extractDigest(m.Val.Digests); err != nil { return fmt.Errorf("extracting digest: %w", err) } return nil } func extractDigest(d *Digests) error { if d == nil { return fmt.Errorf("no digest") } if len(*d) != 1 { return fmt.Errorf("more than one digest") } fmt.Printf("Digest: %x\n", (*d)[0].HashValue) return nil } func extractPSARefValID(k *Mkey) error { if k == nil { return fmt.Errorf("no measurement key") } id, err := k.GetPSARefValID() if err != nil { return fmt.Errorf("getting PSA refval id: %w", err) } fmt.Printf("SignerID: %x\n", id.SignerID) if id.Label != nil { fmt.Printf("Label: %s\n", *id.Label) } if id.Version != nil { fmt.Printf("Version: %s\n", *id.Version) } // ignore alg-id return nil } func extractImplementationID(c *Class) error { if c == nil { return fmt.Errorf("no class") } classID := c.ClassID if classID == nil { return fmt.Errorf("no class-id") } implID, err := classID.GetImplID() if err != nil { return fmt.Errorf("extracting implemenetation-id: %w", err) } fmt.Printf("ImplementationID: %x\n", implID) return nil }
Output: ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b Label: BL Version: 2.1.0 Digest: 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b Label: PRoT Version: 1.3.5 Digest: 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b Label: ARoT Version: 0.1.4 Digest: a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478
Index ¶
- Constants
- Variables
- func IsAbsoluteURI(s string) error
- func MustHexDecode(t *testing.T, s string) []byte
- func NewHashEntry(algID uint64, value []byte) *swid.HashEntry
- type AttestVerifKey
- type CCAPlatformConfigID
- type Class
- func (o *Class) FromCBOR(data []byte) error
- func (o *Class) FromJSON(data []byte) error
- func (o Class) GetIndex() uint64
- func (o Class) GetLayer() uint64
- func (o Class) GetModel() string
- func (o Class) GetVendor() string
- func (o *Class) SetIndex(index uint64) *Class
- func (o *Class) SetLayer(layer uint64) *Class
- func (o *Class) SetModel(model string) *Class
- func (o *Class) SetVendor(vendor string) *Class
- func (o Class) ToCBOR() ([]byte, error)
- func (o Class) ToJSON() ([]byte, error)
- func (o Class) Valid() error
- type ClassID
- func (o ClassID) GetImplID() (ImplID, error)
- func (o ClassID) MarshalCBOR() ([]byte, error)
- func (o ClassID) MarshalJSON() ([]byte, error)
- func (o *ClassID) SetImplID(implID ImplID) *ClassID
- func (o *ClassID) SetOID(s string) *ClassID
- func (o *ClassID) SetUUID(uuid UUID) *ClassID
- func (o ClassID) String() string
- func (o ClassID) Type() ClassIDType
- func (o *ClassID) UnmarshalCBOR(data []byte) error
- func (o *ClassID) UnmarshalJSON(data []byte) error
- func (o ClassID) Unset() bool
- type ClassIDType
- type Comid
- func (o *Comid) AddAttestVerifKey(val AttestVerifKey) *Comid
- func (o *Comid) AddDevIdentityKey(val DevIdentityKey) *Comid
- func (o *Comid) AddEndorsedValue(val EndorsedValue) *Comid
- func (o *Comid) AddEntity(name string, regID *string, roles ...Role) *Comid
- func (o *Comid) AddLinkedTag(tagID interface{}, rel Rel) *Comid
- func (o *Comid) AddReferenceValue(val ReferenceValue) *Comid
- func (o *Comid) FromCBOR(data []byte) error
- func (o *Comid) FromJSON(data []byte) error
- func (o *Comid) SetLanguage(language string) *Comid
- func (o *Comid) SetTagIdentity(tagID interface{}, tagIDVersion uint) *Comid
- func (o Comid) ToCBOR() ([]byte, error)
- func (o Comid) ToJSON() ([]byte, error)
- func (o Comid) ToJSONPretty(indent string) ([]byte, error)
- func (o Comid) Valid() error
- type CryptoKey
- func MustNewCOSEKey(b []byte) *CryptoKey
- func MustNewCertPathThumbprint(he swid.HashEntry) *CryptoKey
- func MustNewCertThumbprint(he swid.HashEntry) *CryptoKey
- func MustNewCryptoKey(k any, typ string) *CryptoKey
- func MustNewPKIXBase64Cert(s string) *CryptoKey
- func MustNewPKIXBase64CertPath(s string) *CryptoKey
- func MustNewPKIXBase64Key(s string) *CryptoKey
- func MustNewThumbprint(he swid.HashEntry) *CryptoKey
- func NewCOSEKey(b []byte) (*CryptoKey, error)
- func NewCertPathThumbprint(he swid.HashEntry) (*CryptoKey, error)
- func NewCertThumbprint(he swid.HashEntry) (*CryptoKey, error)
- func NewCryptoKey(k any, typ string) (*CryptoKey, error)
- func NewPKIXBase64Cert(s string) (*CryptoKey, error)
- func NewPKIXBase64CertPath(s string) (*CryptoKey, error)
- func NewPKIXBase64Key(s string) (*CryptoKey, error)
- func NewThumbprint(he swid.HashEntry) (*CryptoKey, error)
- func (o CryptoKey) MarshalCBOR() ([]byte, error)
- func (o CryptoKey) MarshalJSON() ([]byte, error)
- func (o CryptoKey) PublicKey() (crypto.PublicKey, error)
- func (o CryptoKey) String() string
- func (o *CryptoKey) UnmarshalCBOR(b []byte) error
- func (o *CryptoKey) UnmarshalJSON(b []byte) error
- func (o CryptoKey) Valid() error
- type CryptoKeys
- type DevIdentityKey
- type Digests
- type EndorsedValue
- type Entities
- type Entity
- type Environment
- type Group
- type ICryptoKeyValue
- type ImplID
- type Instance
- func (o Instance) GetUEID() (eat.UEID, error)
- func (o Instance) GetUUID() (UUID, error)
- func (o Instance) MarshalCBOR() ([]byte, error)
- func (o Instance) MarshalJSON() ([]byte, error)
- func (o *Instance) SetUEID(val eat.UEID) *Instance
- func (o *Instance) SetUUID(val uuid.UUID) *Instance
- func (o Instance) String() string
- func (o *Instance) UnmarshalCBOR(data []byte) error
- func (o *Instance) UnmarshalJSON(data []byte) error
- func (o Instance) Valid() error
- type LinkedTag
- type LinkedTags
- type MACaddr
- type Measurement
- func (o *Measurement) AddDigest(algID uint64, digest []byte) *Measurement
- func (o *Measurement) SetIPaddr(a net.IP) *Measurement
- func (o *Measurement) SetKeyCCAPlatformConfigID(ccaPlatformConfigID CCAPlatformConfigID) *Measurement
- func (o *Measurement) SetKeyPSARefValID(psaRefValID PSARefValID) *Measurement
- func (o *Measurement) SetKeyUUID(u UUID) *Measurement
- func (o *Measurement) SetKeyUint(u uint64) *Measurement
- func (o *Measurement) SetMACaddr(a MACaddr) *Measurement
- func (o *Measurement) SetMinSVN(svn uint64) *Measurement
- func (o *Measurement) SetOpFlags(flags ...OpFlags) *Measurement
- func (o *Measurement) SetRawValueBytes(rawValue, rawValueMask []byte) *Measurement
- func (o *Measurement) SetSVN(svn uint64) *Measurement
- func (o *Measurement) SetSerialNumber(sn string) *Measurement
- func (o *Measurement) SetUEID(ueid eat.UEID) *Measurement
- func (o *Measurement) SetUUID(u UUID) *Measurement
- func (o *Measurement) SetVersion(ver string, scheme int64) *Measurement
- func (o Measurement) Valid() error
- type Measurements
- type Mkey
- func (o Mkey) GetCCAPlatformConfigID() (CCAPlatformConfigID, error)
- func (o Mkey) GetKeyUint() (uint64, error)
- func (o Mkey) GetPSARefValID() (PSARefValID, error)
- func (o Mkey) IsCCAPlatformConfigID() bool
- func (o Mkey) IsPSARefValID() bool
- func (o Mkey) IsSet() bool
- func (o Mkey) MarshalCBOR() ([]byte, error)
- func (o Mkey) MarshalJSON() ([]byte, error)
- func (o *Mkey) UnmarshalCBOR(data []byte) error
- func (o *Mkey) UnmarshalJSON(data []byte) error
- func (o Mkey) Valid() error
- type Mval
- type OID
- type OpFlags
- type PSARefValID
- type RawValue
- type ReferenceValue
- type Rel
- type Role
- type Roles
- type SVN
- type TagIdentity
- type TaggedCCAPlatformConfigID
- type TaggedCOSEKey
- type TaggedCertPathThumbprint
- type TaggedCertThumbprint
- type TaggedImplID
- type TaggedMinSVN
- type TaggedOID
- type TaggedPKIXBase64Cert
- type TaggedPKIXBase64CertPath
- type TaggedPKIXBase64Key
- type TaggedPSARefValID
- type TaggedRawValueBytes
- type TaggedSVN
- type TaggedThumbprint
- type TaggedUEID
- type TaggedURI
- type TaggedUUID
- type Triples
- type UEID
- type UUID
- type Version
Examples ¶
Constants ¶
const ( ClassIDTypeUUID = ClassIDType(iota) ClassIDTypeImplID ClassIDTypeOID ClassIDTypeUnknown = ^ClassIDType(0) )
const ( // PKIXBase64KeyType indicates a PEM-encoded SubjectPublicKeyInfo. See // https://www.rfc-editor.org/rfc/rfc7468#section-13 PKIXBase64KeyType = "pkix-base64-key" // PKIXBase64CertType indicates a PEM-encoded X.509 public key // certificate. See https://www.rfc-editor.org/rfc/rfc7468#section-5 PKIXBase64CertType = "pkix-base64-cert" // PKIXBase64CertPathType indicates a X.509 certificate chain created // by the concatenation of as many PEM encoded X.509 certificates as // needed. The certificates MUST be concatenated in order so that each // directly certifies the one preceding. PKIXBase64CertPathType = "pkix-base64-cert-path" // COSEKeyType represents a CBOR encoded COSE_Key or COSE_KeySet. See // https://www.rfc-editor.org/rfc/rfc9052#section-7 COSEKeyType = "cose-key" // ThumbprintType represents a digest of a raw public key. The digest // value may be used to find the public key if contained in a lookup // table. ThumbprintType = "thumbprint" // CertThumbprintType represents a digest of a certificate. The digest // value may be used to find the certificate if contained in a lookup // table. CertThumbprintType = "cert-thumbprint" // CertPathThumbprintType represents a digest of a certification path. // The digest value may be used to find the certificate path if // contained in a lookup table. CertPathThumbprintType = "cert-path-thumbprint" )
const ( // MaxASN1OIDLen is the maximum OID length accepted by the implementation MaxASN1OIDLen = 255 // MinNumOIDArcs represents the minimum required arcs for a valid OID MinNumOIDArcs = 3 )
const MaxUint64 = ^uint64(0)
Variables ¶
var ( TestUUIDString = "31fb5abf-023e-4992-aa4e-95f9c1503bfa" TestUUID = UUID(uuid.Must(uuid.Parse(TestUUIDString))) TestImplID = ImplID([32]byte{ 0x61, 0x63, 0x6d, 0x65, 0x2d, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x69, 0x64, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, }) TestOID = "2.5.2.8192" TestRegID = "https://acme.example" TestMACaddr, _ = net.ParseMAC("02:00:5e:10:00:00:00:01") TestIPaddr = net.ParseIP("2001:db8::68") TestUEIDString = "02deadbeefdead" TestUEID = eat.UEID(MustHexDecode(nil, TestUEIDString)) TestSignerID = MustHexDecode(nil, "acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b") TestTagID = "urn:example:veraison" TestMKey uint64 = 700 TestCCALabel = "cca-platform-config" TestECPrivKey = `` /* 226-byte string literal not displayed */ TestECPubKey = `` /* 177-byte string literal not displayed */ TestCert = `` /* 712-byte string literal not displayed */ TestCertPath = `` /* 6439-byte string literal not displayed */ TestCOSEKey = MustHexDecode(nil, `a501020258246d65726961646f632e6272616e64796275636b406275636b6c616e642e6578616d706c65200121582065eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d2258201e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c`) TestCOSEKeySetOne = MustHexDecode(nil, `81a501020258246d65726961646f632e6272616e64796275636b406275636b6c616e642e6578616d706c65200121582065eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d2258201e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c`) TestCOSEKeySetMulti = MustHexDecode(nil, `82a501020258246d65726961646f632e6272616e64796275636b406275636b6c616e642e6578616d706c65200121582065eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d2258201e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19ca601010327048202647369676e0543030201200621582015522ef15729ccf39509ea5c15a26be949e38807a5c26ef9281487ef4ae67b46`) TestThumbprint = swid.HashEntry{ HashAlgID: 1, HashValue: MustHexDecode(nil, `68e656b251e67e8358bef8483ab0d51c6619f3e7a1a9f0e75838d41ff368f728`), } )
var ( PSARefValJSONTemplate = `` /* 1556-byte string literal not displayed */ PSAKeysJSONTemplate = `` /* 1541-byte string literal not displayed */ CCARefValJSONTemplate = `` /* 1806-byte string literal not displayed */ )
Functions ¶
func IsAbsoluteURI ¶
Types ¶
type AttestVerifKey ¶
type AttestVerifKey struct { Environment Environment `json:"environment"` VerifKeys CryptoKeys `json:"verification-keys"` // contains filtered or unexported fields }
AttestVerifKey stores an attest-key-triple-record with CBOR and JSON serializations. Note that the CBOR serialization packs the structure into an array. Instead, when serializing to JSON, the structure is converted into an object.
func (AttestVerifKey) Valid ¶
func (o AttestVerifKey) Valid() error
type CCAPlatformConfigID ¶
type CCAPlatformConfigID string
func (CCAPlatformConfigID) Empty ¶
func (o CCAPlatformConfigID) Empty() bool
func (CCAPlatformConfigID) Get ¶
func (o CCAPlatformConfigID) Get() (CCAPlatformConfigID, error)
func (*CCAPlatformConfigID) Set ¶
func (o *CCAPlatformConfigID) Set(v string) error
type Class ¶
type Class struct { ClassID *ClassID `cbor:"0,keyasint,omitempty" json:"id,omitempty"` Vendor *string `cbor:"1,keyasint,omitempty" json:"vendor,omitempty"` Model *string `cbor:"2,keyasint,omitempty" json:"model,omitempty"` Layer *uint64 `cbor:"3,keyasint,omitempty" json:"layer,omitempty"` Index *uint64 `cbor:"4,keyasint,omitempty" json:"index,omitempty"` }
Class represents the class of the (target / attesting) environment. The only required field is the class unique identifier (see ClassID). Optionally, information about the specific brand & product as well as its topological coordinates within the wider device can be recorded.
func NewClassImplID ¶
NewClassImplID instantiates a new Class object that identifies the specified PSA Implementation ID
func NewClassOID ¶
NewClassOID instantiates a new Class object that identifies the OID
func NewClassUUID ¶
NewClassUUID instantiates a new Class object with the specified UUID as identifier
func (Class) GetIndex ¶
GetIndex returns the index number if it set in the target Class. Otherwise, uint64_max is returned.
func (Class) GetLayer ¶
GetLayer returns the layer number if it set in the target Class. Otherwise, uint64_max is returned.
func (Class) GetModel ¶
GetModel returns the model string if it set in the target Class. Otherwise, an empty string is returned.
func (Class) GetVendor ¶
GetVendor returns the vendor string if it set in the target Class. Otherwise, an empty string is returned.
func (*Class) SetIndex ¶
SetIndex sets the "index" (i.e., the identifier of the environment instance in a specific layer) as indicated
func (*Class) SetLayer ¶
SetLayer sets the "layer" (i.e., the logical/topological location of the environment in the device) as indicated
type ClassID ¶
type ClassID struct {
// contains filtered or unexported fields
}
ClassID represents a $class-id-type-choice, which can be one of TaggedUUID, TaggedOID, or TaggedImplID (PSA-specific extension)
func (ClassID) MarshalCBOR ¶
MarshalCBOR serializes the target ClassID to CBOR
func (ClassID) MarshalJSON ¶
MarshalJSON serializes the target ClassID to JSON
func (*ClassID) SetImplID ¶
SetImplID sets the value of the targed ClassID to the supplied PSA Implementation ID (see Section 3.2.2 of draft-tschofenig-rats-psa-token)
func (*ClassID) SetOID ¶
SetOID sets the value of the targed ClassID to the supplied OID. The OID is a string in dotted-decimal notation
func (ClassID) String ¶
String returns a printable string of the ClassID value. UUIDs use the canonical 8-4-4-4-12 format, PSA Implementation IDs are base64 encoded. OIDs are output in dotted-decimal notation.
func (ClassID) Type ¶
func (o ClassID) Type() ClassIDType
Type returns the type of the target ClassID, i.e., one of UUID, OID or PSA Implementation ID
func (*ClassID) UnmarshalCBOR ¶
UnmarshalCBOR deserializes the supplied CBOR buffer into the target ClassID. It is undefined behavior to try and inspect the target ClassID in case this method returns an error.
func (*ClassID) UnmarshalJSON ¶
UnmarshalJSON deserializes the supplied JSON object into the target ClassID The class id object must have one of the following shapes:
UUID:
{ "type": "uuid", "value": "69E027B2-7157-4758-BCB4-D9F167FE49EA" }
OID:
{ "type": "oid", "value": "2.16.840.1.113741.1.15.4.2" }
PSA Implementation ID:
{ "type": "psa.impl-id", "value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE=" }
type ClassIDType ¶
type ClassIDType uint16
type Comid ¶
type Comid struct { Language *string `cbor:"0,keyasint,omitempty" json:"lang,omitempty"` TagIdentity TagIdentity `cbor:"1,keyasint" json:"tag-identity"` Entities *Entities `cbor:"2,keyasint,omitempty" json:"entities,omitempty"` LinkedTags *LinkedTags `cbor:"3,keyasint,omitempty" json:"linked-tags,omitempty"` Triples Triples `cbor:"4,keyasint" json:"triples"` }
Comid is the top-level representation of a Concise Module IDentifier with CBOR and JSON serialization.
func (*Comid) AddAttestVerifKey ¶
func (o *Comid) AddAttestVerifKey(val AttestVerifKey) *Comid
AddAttestVerifKey adds the supplied endorsed value to the attest-key-triples list of the target Comid.
func (*Comid) AddDevIdentityKey ¶
func (o *Comid) AddDevIdentityKey(val DevIdentityKey) *Comid
AddDevIdentityKey adds the supplied identity key to the identity-triples list of the target Comid.
func (*Comid) AddEndorsedValue ¶
func (o *Comid) AddEndorsedValue(val EndorsedValue) *Comid
AddEndorsedValue adds the supplied endorsed value to the endorsed-triples list of the target Comid.
func (*Comid) AddEntity ¶
AddEntity adds an organizational entity, together with the roles this entity claims with regards to the CoMID, to the target Comid. name is the entity name, regID is a URI that uniquely identifies the entity, and roles are one or more claimed roles chosen from the following: RoleTagCreator, RoleCreator and RoleMaintainer.
func (*Comid) AddLinkedTag ¶
AddLinkedTag adds a link relationship of type rel between the target Comid and another CoMID identified by its tagID. The rel parameter can be one of RelSupplements or RelReplaces.
func (*Comid) AddReferenceValue ¶
func (o *Comid) AddReferenceValue(val ReferenceValue) *Comid
AddReferenceValue adds the supplied reference value to the reference-triples list of the target Comid.
func (*Comid) SetLanguage ¶
SetLanguage sets the language used in the target Comid to the supplied language tag. See also: BCP 47 and the IANA Language subtag registry.
func (*Comid) SetTagIdentity ¶
SetTagIdentity sets the identifier of the target Comid to the supplied tagID, which MUST be of type string or [16]byte. A tagIDVersion must also be supplied to disambiguate between different revisions of the same tag identity. If the tagID is newly minted, use 0. If the tagID has already been associated with a CoMID, pick a tagIDVersion greater than any other existing tagIDVersion's associated with that tagID.
type CryptoKey ¶
type CryptoKey struct {
Value ICryptoKeyValue
}
CryptoKey is the struct implementing CoRIM crypto-key-type-choice. See https://www.ietf.org/archive/id/draft-ietf-rats-corim-02.html#name-crypto-keys
func MustNewCOSEKey ¶
func MustNewCertThumbprint ¶
func MustNewCryptoKey ¶
MustNewCryptoKey is the same as NewCryptoKey, but does not return an error, and panics if there is a problem.
func MustNewPKIXBase64Cert ¶
func MustNewPKIXBase64Key ¶
func MustNewThumbprint ¶
func NewCOSEKey ¶
func NewCryptoKey ¶
NewCryptoKey returns the pointer to a new CryptoKey of the specified type, constructed using the provided value k. The type of k depends on the specified crypto key type. For PKIX types, k must be a string. For COSE_Key, k must be a []byte. For thumbprint types, k must be a swid.HashEntry.
func NewPKIXBase64Cert ¶
func NewPKIXBase64CertPath ¶
func NewPKIXBase64Key ¶
func (CryptoKey) MarshalCBOR ¶
MarshalCBOR returns a []byte containing the CBOR representation of the CryptoKey.
func (CryptoKey) MarshalJSON ¶
MarshalJSON returns a []byte containing the JSON representation of the CryptoKey.
func (CryptoKey) PublicKey ¶
PublicKey returns a crypto.PublicKey constructed from the CryptoKey's underlying value. This returns an error if the CryptoKey is one of the thumbprint types.
func (*CryptoKey) UnmarshalCBOR ¶
UnmarshalCBOR populates the CryptoKey from the CBOR representation inside the provided []byte.
func (*CryptoKey) UnmarshalJSON ¶
UnmarshalJSON populates the CryptoKey from the JSON representation inside the provided []byte.
type CryptoKeys ¶
type CryptoKeys []*CryptoKey
CryptoKeys is an array of *CryptoKey
func NewCryptoKeys ¶
func NewCryptoKeys() *CryptoKeys
NewCryptoKeys instantiates an empty CryptoKeys
func (*CryptoKeys) Add ¶
func (o *CryptoKeys) Add(v *CryptoKey) *CryptoKeys
Add the supplied *CryptoKey to the CryptoKeys
func (CryptoKeys) Valid ¶
func (o CryptoKeys) Valid() error
Valid returns an error if any of the contianed keys fail to validate, or if CryptoKeys is empty
type DevIdentityKey ¶
type DevIdentityKey struct { Environment Environment `json:"environment"` VerifKeys CryptoKeys `json:"verification-keys"` // contains filtered or unexported fields }
DevIdentityKey stores an identity-triple-record with CBOR and JSON serializations. Note that the CBOR serialization packs the structure into an array. Instead, when serializing to JSON, the structure is converted into an object.
func (DevIdentityKey) Valid ¶
func (o DevIdentityKey) Valid() error
type Digests ¶
Digests is an alias for an array of SWID HashEntry
type EndorsedValue ¶
type EndorsedValue struct { Environment Environment `json:"environment"` Measurements Measurements `json:"measurements"` // contains filtered or unexported fields }
EndorsedValue stores an endorsed-triple-record with CBOR and JSON serializations. Note that the CBOR serialization packs the structure into an array. Instead, when serializing to JSON, the structure is converted into an object.
func (EndorsedValue) Valid ¶
func (o EndorsedValue) Valid() error
type Entities ¶
type Entities []Entity
Entities is an array of entity-map's
type Entity ¶
type Entity struct { EntityName string `cbor:"0,keyasint" json:"name"` RegID *TaggedURI `cbor:"1,keyasint,omitempty" json:"regid,omitempty"` Roles Roles `cbor:"2,keyasint" json:"roles"` }
Entity stores an entity-map capable of CBOR and JSON serializations.
func (*Entity) SetEntityName ¶
type Environment ¶
type Environment struct { Class *Class `cbor:"0,keyasint,omitempty" json:"class,omitempty"` Instance *Instance `cbor:"1,keyasint,omitempty" json:"instance,omitempty"` Group *Group `cbor:"2,keyasint,omitempty" json:"group,omitempty"` }
Environment stores the identifying information about a target or attesting environment at the class, instance and group scope. The Environment type has JSON and CBOR serializations.
func (*Environment) FromCBOR ¶
func (o *Environment) FromCBOR(data []byte) error
FromCBOR deserializes the supplied CBOR data into the target Environment
func (*Environment) FromJSON ¶
func (o *Environment) FromJSON(data []byte) error
FromJSON deserializes the supplied JSON string into the target Environment
func (Environment) ToCBOR ¶
func (o Environment) ToCBOR() ([]byte, error)
ToCBOR serializes the target Environment to CBOR (if the Environment is "valid")
func (Environment) ToJSON ¶
func (o Environment) ToJSON() ([]byte, error)
ToJSON serializes the target Environment to JSON (if the Environment is "valid")
func (Environment) Valid ¶
func (o Environment) Valid() error
Valid checks the validity (according to the spec) of the target Environment
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group stores a group identity. The supported format is UUID.
func NewGroupUUID ¶
NewGroupUUID instantiates a new group with the supplied UUID identity
func (Group) MarshalCBOR ¶
MarshalCBOR serializes the target group to CBOR
func (Group) MarshalJSON ¶
func (Group) String ¶
String returns a printable string of the Group value. UUIDs use the canonical 8-4-4-4-12 format, UEIDs are hex encoded.
func (*Group) UnmarshalCBOR ¶
UnmarshalCBOR deserializes the supplied CBOR into the target group
func (*Group) UnmarshalJSON ¶
UnmarshalJSON deserializes the supplied JSON type/value object into the Group target. The only supported format is UUID, e.g.:
{ "type": "uuid", "value": "69E027B2-7157-4758-BCB4-D9F167FE49EA" }
type ICryptoKeyValue ¶
type ICryptoKeyValue interface { // String returns the string representation of the ICryptoKeyValue. String() string // Valid returns an error if validation of the ICryptoKeyValue fails, // or nil if it succeeds. Valid() error // PublicKey returns a crypto.PublicKey constructed from the // ICryptoKeyValue's underlying value. This returns an error if the // ICryptoKeyValue is one of the thumbprint types. PublicKey() (crypto.PublicKey, error) }
ICryptoKeyValue is the interface implemented by the concrete CryptoKey value types.
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance stores an instance identity. The supported formats are UUID and UEID.
func NewInstanceUEID ¶
NewInstanceUEID instantiates a new instance with the supplied UEID identity
func NewInstanceUUID ¶
NewInstanceUUID instantiates a new instance with the supplied UUID identity
func (Instance) MarshalCBOR ¶
MarshalCBOR serializes the target instance to CBOR
func (Instance) MarshalJSON ¶
func (Instance) String ¶
String returns a printable string of the Instance value. UUIDs use the canonical 8-4-4-4-12 format, UEIDs are hex encoded.
func (*Instance) UnmarshalCBOR ¶
func (*Instance) UnmarshalJSON ¶
UnmarshalJSON deserializes the supplied JSON type/value object into the Group target. The supported formats are UUID, e.g.:
{ "type": "uuid", "value": "69E027B2-7157-4758-BCB4-D9F167FE49EA" }
and UEID:
{ "type": "ueid", "value": "Ad6tvu/erb7v3q2+796tvu8=" }
type LinkedTag ¶
type LinkedTag struct { LinkedTagID swid.TagID `cbor:"0,keyasint" json:"target"` Rel Rel `cbor:"1,keyasint" json:"rel"` }
LinkedTag stores one link relation of type Rel between the embedding CoMID (the link context) and the referenced CoMID (the link target). The link can be viewed as a statement of the form: "$link_context $link_relation_type $link_target".
func NewLinkedTag ¶
func NewLinkedTag() *LinkedTag
type LinkedTags ¶
type LinkedTags []LinkedTag
LinkedTags is an array of LinkedTag
func NewLinkedTags ¶
func NewLinkedTags() *LinkedTags
func (*LinkedTags) AddLinkedTag ¶
func (o *LinkedTags) AddLinkedTag(lt LinkedTag) *LinkedTags
AddLinkedTag adds the supplied linked Tag-map to the target Entities
func (LinkedTags) Valid ¶
func (o LinkedTags) Valid() error
type MACaddr ¶
type MACaddr net.HardwareAddr
MACaddr is an HW address (e.g., IEEE 802 MAC-48, EUI-48, EUI-64)
Note: Since TextUnmarshal is not defined on net.HardwareAddr (see: https://github.com/golang/go/issues/29678) we need to create an alias type with a custom decoder.
func (MACaddr) MarshalJSON ¶
func (*MACaddr) UnmarshalJSON ¶
UnmarshalJSON deserialize a MAC address in textual form into the MACaddr target, e.g.:
"mac-addr": "00:00:5e:00:53:01"
or
"mac-addr": "02:00:5e:10:00:00:00:01"
Supported formats are IEEE 802 MAC-48, EUI-48, EUI-64, e.g.:
00:00:5e:00:53:01 00-00-5e-00-53-01 02:00:5e:10:00:00:00:01 02-00-5e-10-00-00-00-01
type Measurement ¶
type Measurement struct { Key *Mkey `cbor:"0,keyasint,omitempty" json:"key,omitempty"` Val Mval `cbor:"1,keyasint" json:"value"` }
Measurement stores a measurement-map with CBOR and JSON serializations.
func NewCCAPlatCfgMeasurement ¶
func NewCCAPlatCfgMeasurement(ccaPlatformConfigID CCAPlatformConfigID) *Measurement
NewCCAPlatCfgMeasurement instantiates a new measurement-map with the key set to the supplied CCA platform-config-id
func NewMeasurement ¶
func NewMeasurement() *Measurement
NewMeasurement instantiates an empty measurement
func NewPSAMeasurement ¶
func NewPSAMeasurement(psaRefValID PSARefValID) *Measurement
NewPSAMeasurement instantiates a new measurement-map with the key set to the supplied PSA refval-id
func NewUUIDMeasurement ¶
func NewUUIDMeasurement(uuid UUID) *Measurement
NewUUIDMeasurement instantiates a new measurement-map with the key set to the supplied UUID
func NewUintMeasurement ¶
func NewUintMeasurement(mkey uint64) *Measurement
NewUintMeasurement instantiates a new measurement-map with the key set to the supplied Uint
func (*Measurement) AddDigest ¶
func (o *Measurement) AddDigest(algID uint64, digest []byte) *Measurement
AddDigest add the supplied digest - comprising the digest itself together with the hash algorithm used to obtain it - to the measurement-values-map of the target measurement
func (*Measurement) SetIPaddr ¶
func (o *Measurement) SetIPaddr(a net.IP) *Measurement
SetIPaddr sets the supplied IP (v4 or v6) address in the measurement-values-map of the target measurement
func (*Measurement) SetKeyCCAPlatformConfigID ¶
func (o *Measurement) SetKeyCCAPlatformConfigID(ccaPlatformConfigID CCAPlatformConfigID) *Measurement
SetKeyCCAPlatformConfigID sets the key of the target measurement-map to the supplied CCA platform-config-id
func (*Measurement) SetKeyPSARefValID ¶
func (o *Measurement) SetKeyPSARefValID(psaRefValID PSARefValID) *Measurement
SetKeyPSARefValID sets the key of the target measurement-map to the supplied PSA refval-id
func (*Measurement) SetKeyUUID ¶
func (o *Measurement) SetKeyUUID(u UUID) *Measurement
SetKeyKeyUUID sets the key of the target measurement-map to the supplied UUID
func (*Measurement) SetKeyUint ¶
func (o *Measurement) SetKeyUint(u uint64) *Measurement
SetKeyUint sets the key of the target measurement-map to the supplied unsigned integer
func (*Measurement) SetMACaddr ¶
func (o *Measurement) SetMACaddr(a MACaddr) *Measurement
SetMACaddr sets the supplied MAC address in the measurement-values-map of the target measurement
func (*Measurement) SetMinSVN ¶
func (o *Measurement) SetMinSVN(svn uint64) *Measurement
SetMinSVN sets the supplied min-svn in the measurement-values-map of the target measurement
func (*Measurement) SetOpFlags ¶
func (o *Measurement) SetOpFlags(flags ...OpFlags) *Measurement
SetOpFlags sets the supplied operational flags in the measurement-values-map of the target measurement
func (*Measurement) SetRawValueBytes ¶
func (o *Measurement) SetRawValueBytes(rawValue, rawValueMask []byte) *Measurement
SetRawValueBytes sets the supplied raw-value and its mask in the measurement-values-map of the target measurement
func (*Measurement) SetSVN ¶
func (o *Measurement) SetSVN(svn uint64) *Measurement
SetSVN sets the supplied svn in the measurement-values-map of the target measurement
func (*Measurement) SetSerialNumber ¶
func (o *Measurement) SetSerialNumber(sn string) *Measurement
SetSerialNumber sets the supplied serial number in the measurement-values-map of the target measurement
func (*Measurement) SetUEID ¶
func (o *Measurement) SetUEID(ueid eat.UEID) *Measurement
SetUEID sets the supplied ueid in the measurement-values-map of the target measurement
func (*Measurement) SetUUID ¶
func (o *Measurement) SetUUID(u UUID) *Measurement
SetUUID sets the supplied uuid in the measurement-values-map of the target measurement
func (*Measurement) SetVersion ¶
func (o *Measurement) SetVersion(ver string, scheme int64) *Measurement
func (Measurement) Valid ¶
func (o Measurement) Valid() error
type Measurements ¶
type Measurements []Measurement
Measurements is an array of Measurement
func NewMeasurements ¶
func NewMeasurements() *Measurements
NewMeasurements instantiates an empty Measurements array
func (*Measurements) AddMeasurement ¶
func (o *Measurements) AddMeasurement(m *Measurement) *Measurements
AddMeasurements adds the supplied Measurement to the target Measurement
func (Measurements) Valid ¶
func (o Measurements) Valid() error
type Mkey ¶
type Mkey struct {
// contains filtered or unexported fields
}
Mkey stores a $measured-element-type-choice. The supported types are UUID, PSA refval-id, CCA platform-config-id and unsigned integer TO DO Add tagged OID: see https://github.com/veraison/corim/issues/35
func (Mkey) GetCCAPlatformConfigID ¶
func (o Mkey) GetCCAPlatformConfigID() (CCAPlatformConfigID, error)
func (Mkey) GetKeyUint ¶
func (Mkey) GetPSARefValID ¶
func (o Mkey) GetPSARefValID() (PSARefValID, error)
func (Mkey) IsCCAPlatformConfigID ¶
func (Mkey) IsPSARefValID ¶
func (Mkey) MarshalCBOR ¶
func (Mkey) MarshalJSON ¶
MarshalJSON serializes the target Mkey into the type'n'value JSON object Supported types are: uuid, psa.refval-id and unsigned integer
func (*Mkey) UnmarshalCBOR ¶
func (*Mkey) UnmarshalJSON ¶
UnmarshalJSON deserializes the type'n'value JSON object into the target Mkey
type Mval ¶
type Mval struct { Ver *Version `cbor:"0,keyasint,omitempty" json:"version,omitempty"` SVN *SVN `cbor:"1,keyasint,omitempty" json:"svn,omitempty"` Digests *Digests `cbor:"2,keyasint,omitempty" json:"digests,omitempty"` OpFlags *OpFlags `cbor:"3,keyasint,omitempty" json:"op-flags,omitempty"` RawValue *RawValue `cbor:"4,keyasint,omitempty" json:"raw-value,omitempty"` RawValueMask *[]byte `cbor:"5,keyasint,omitempty" json:"raw-value-mask,omitempty"` MACAddr *MACaddr `cbor:"6,keyasint,omitempty" json:"mac-addr,omitempty"` IPAddr *net.IP `cbor:"7,keyasint,omitempty" json:"ip-addr,omitempty"` SerialNumber *string `cbor:"8,keyasint,omitempty" json:"serial-number,omitempty"` UEID *eat.UEID `cbor:"9,keyasint,omitempty" json:"ueid,omitempty"` UUID *UUID `cbor:"10,keyasint,omitempty" json:"uuid,omitempty"` }
Mval stores a measurement-values-map with JSON and CBOR serializations.
type OID ¶
type OID []byte
BER-encoded absolute OID
func (*OID) FromString ¶
func (OID) MarshalJSON ¶
func (*OID) UnmarshalJSON ¶
type OpFlags ¶
type OpFlags uint8
OpFlags implements the flags-type, mapping to DiceTcbInfo.flags via the operational flags not-configured, not-secure, recovery and debug. If the flags field is omitted, all flags are assumed to be 0.
func NewOpFlags ¶
func NewOpFlags() *OpFlags
func (OpFlags) MarshalJSON ¶
func (*OpFlags) SetOpFlags ¶
SetFlags sets the target object as specified. As many flags as necessary can be specified in one call.
func (*OpFlags) UnmarshalJSON ¶
UnmarshalJSON provides a custom deserializer for the OpFlags type that uses an array of identifiers rather than a bit set, e.g.:
"op-flags": [ "notSecure", "debug" ]
type PSARefValID ¶
type PSARefValID struct { Label *string `cbor:"1,keyasint,omitempty" json:"label,omitempty"` Version *string `cbor:"4,keyasint,omitempty" json:"version,omitempty"` SignerID []byte `cbor:"5,keyasint" json:"signer-id"` // 32, 48 or 64 }
PSARefValID stores a PSA refval-id with CBOR and JSON serializations (See https://datatracker.ietf.org/doc/html/draft-xyz-rats-psa-endorsements)
func NewPSARefValID ¶
func NewPSARefValID(signerID []byte) *PSARefValID
func (*PSARefValID) SetLabel ¶
func (o *PSARefValID) SetLabel(label string) *PSARefValID
func (*PSARefValID) SetVersion ¶
func (o *PSARefValID) SetVersion(version string) *PSARefValID
func (PSARefValID) Valid ¶
func (o PSARefValID) Valid() error
Valid checks the validity (according to the spec) of the target PSARefValID
type RawValue ¶
type RawValue struct {
// contains filtered or unexported fields
}
RawValue models a $raw-value-type-choice. For now, the only available type is bytes.
func NewRawValue ¶
func NewRawValue() *RawValue
func (RawValue) MarshalCBOR ¶
func (RawValue) MarshalJSON ¶
func (*RawValue) UnmarshalCBOR ¶
func (*RawValue) UnmarshalJSON ¶
UnmarshalJSON deserializes the type'n'value JSON object into the target RawValue. The only supported type is "bytes" with value
type ReferenceValue ¶
type ReferenceValue struct { Environment Environment `json:"environment"` Measurements Measurements `json:"measurements"` // contains filtered or unexported fields }
func (ReferenceValue) Valid ¶
func (o ReferenceValue) Valid() error
type SVN ¶
type SVN struct {
// contains filtered or unexported fields
}
func (SVN) MarshalCBOR ¶
func (SVN) MarshalJSON ¶
func (*SVN) UnmarshalCBOR ¶
func (*SVN) UnmarshalJSON ¶
Supported formats: { "type": "exact-value", "value": 123 } -> SVN { "type": "min-value", "value": 123 } -> MinSVN
type TagIdentity ¶
type TagIdentity struct { TagID swid.TagID `cbor:"0,keyasint" json:"id"` TagVersion uint `cbor:"1,keyasint,omitempty" json:"version,omitempty"` }
func (TagIdentity) Valid ¶
func (o TagIdentity) Valid() error
type TaggedCCAPlatformConfigID ¶
type TaggedCCAPlatformConfigID CCAPlatformConfigID
type TaggedCOSEKey ¶
type TaggedCOSEKey []byte
TaggedCOSEKey is a CBOR encoded COSE_Key or COSE_KeySet. See https://www.rfc-editor.org/rfc/rfc9052#section-7
func (TaggedCOSEKey) MarshalCBOR ¶
func (o TaggedCOSEKey) MarshalCBOR() ([]byte, error)
func (TaggedCOSEKey) String ¶
func (o TaggedCOSEKey) String() string
func (*TaggedCOSEKey) UnmarshalCBOR ¶
func (o *TaggedCOSEKey) UnmarshalCBOR(b []byte) error
func (TaggedCOSEKey) Valid ¶
func (o TaggedCOSEKey) Valid() error
type TaggedCertPathThumbprint ¶
type TaggedCertPathThumbprint struct {
// contains filtered or unexported fields
}
TaggedCertPathThumbprint represents a digest of a certification path. The digest value may be used to find the certificate path if contained in a lookup table.
type TaggedCertThumbprint ¶
type TaggedCertThumbprint struct {
// contains filtered or unexported fields
}
TaggedCertThumbprint represents a digest of a certificate. The digest value may be used to find the certificate if contained in a lookup table.
type TaggedImplID ¶
type TaggedImplID ImplID
type TaggedMinSVN ¶
type TaggedMinSVN uint64
type TaggedPKIXBase64Cert ¶
type TaggedPKIXBase64Cert string
TaggedPKIXBase64Cert is a PEM-encoded X.509 public key certificate. See https://www.rfc-editor.org/rfc/rfc7468#section-5
func (TaggedPKIXBase64Cert) PublicKey ¶
func (o TaggedPKIXBase64Cert) PublicKey() (crypto.PublicKey, error)
func (TaggedPKIXBase64Cert) String ¶
func (o TaggedPKIXBase64Cert) String() string
func (TaggedPKIXBase64Cert) Valid ¶
func (o TaggedPKIXBase64Cert) Valid() error
type TaggedPKIXBase64CertPath ¶
type TaggedPKIXBase64CertPath string
TaggedPKIXBase64CertPath is a X.509 certificate chain created by the concatenation of as many PEM encoded X.509 certificates as needed. The certificates MUST be concatenated in order so that each directly certifies the one preceding.
func (TaggedPKIXBase64CertPath) PublicKey ¶
func (o TaggedPKIXBase64CertPath) PublicKey() (crypto.PublicKey, error)
func (TaggedPKIXBase64CertPath) String ¶
func (o TaggedPKIXBase64CertPath) String() string
func (TaggedPKIXBase64CertPath) Valid ¶
func (o TaggedPKIXBase64CertPath) Valid() error
type TaggedPKIXBase64Key ¶
type TaggedPKIXBase64Key string
TaggedPKIXBase64Key is a PEM-encoded SubjectPublicKeyInfo. See https://www.rfc-editor.org/rfc/rfc7468#section-13
func (TaggedPKIXBase64Key) PublicKey ¶
func (o TaggedPKIXBase64Key) PublicKey() (crypto.PublicKey, error)
func (TaggedPKIXBase64Key) String ¶
func (o TaggedPKIXBase64Key) String() string
func (TaggedPKIXBase64Key) Valid ¶
func (o TaggedPKIXBase64Key) Valid() error
type TaggedPSARefValID ¶
type TaggedPSARefValID PSARefValID
type TaggedRawValueBytes ¶
type TaggedRawValueBytes []byte
TaggedRawValueBytes is an alias for []byte to allow its automatic tagging
type TaggedThumbprint ¶
type TaggedThumbprint struct {
// contains filtered or unexported fields
}
ThumbprintTypeTaggedThumbprint represents a digest of a raw public key. The digest value may be used to find the public key if contained in a lookup table.
type TaggedUEID ¶
type TaggedUEID UEID
TaggedUEID is an alias to allow automatic tagging of an UEID type
type TaggedUUID ¶
type TaggedUUID UUID
TaggedUUID is an alias to allow automatic tagging of a UUID type
type Triples ¶
type Triples struct { ReferenceValues *[]ReferenceValue `cbor:"0,keyasint,omitempty" json:"reference-values,omitempty"` EndorsedValues *[]EndorsedValue `cbor:"1,keyasint,omitempty" json:"endorsed-values,omitempty"` AttestVerifKeys *[]AttestVerifKey `cbor:"2,keyasint,omitempty" json:"attester-verification-keys,omitempty"` DevIdentityKeys *[]DevIdentityKey `cbor:"3,keyasint,omitempty" json:"dev-identity-keys,omitempty"` }
func (*Triples) AddAttestVerifKey ¶
func (o *Triples) AddAttestVerifKey(val AttestVerifKey) *Triples
func (*Triples) AddDevIdentityKey ¶
func (o *Triples) AddDevIdentityKey(val DevIdentityKey) *Triples
func (*Triples) AddEndorsedValue ¶
func (o *Triples) AddEndorsedValue(val EndorsedValue) *Triples
func (*Triples) AddReferenceValue ¶
func (o *Triples) AddReferenceValue(val ReferenceValue) *Triples
type UEID ¶
UEID is an Unique Entity Identifier
func (UEID) MarshalJSON ¶
func (*UEID) UnmarshalJSON ¶
UnmarshalJSON deserializes the supplied string into the UEID target
type UUID ¶
UUID represents an Universally Unique Identifier (UUID, see RFC4122)
func (UUID) MarshalJSON ¶
MarshalJSON serialize the target UUID to a JSON string in canonical 8-4-4-4-12 format
func (*UUID) UnmarshalJSON ¶
UnmarshalJSON deserializes the supplied string into the UUID target The UUID string in expected to be in canonical 8-4-4-4-12 format
type Version ¶
type Version struct { Version string `cbor:"0,keyasint" json:"value"` Scheme swid.VersionScheme `cbor:"1,keyasint" json:"scheme"` }
Version stores a version-map with JSON and CBOR serializations.
func NewVersion ¶
func NewVersion() *Version
func (*Version) SetVersion ¶
Source Files ¶
- attestverifkey.go
- cbor.go
- ccaplatformconfigid.go
- class.go
- classid.go
- comid.go
- cryptokey.go
- cryptokeys.go
- devidentitykey.go
- digests.go
- endorsedvalue.go
- entity.go
- environment.go
- group.go
- instance.go
- linkedtag.go
- macaddr.go
- measurement.go
- measurements.go
- oid.go
- opflag.go
- psareferencevalue.go
- rawvalue.go
- referencevalue.go
- rel.go
- role.go
- svn.go
- tagidentity.go
- test_vars.go
- triples.go
- typeandvalue.go
- ueid.go
- uuid.go