1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright 2023 Contributors to the Veraison project.
// SPDX-License-Identifier: Apache-2.0
//! The store module provides traits and concrete types to implement the
//! interfaces between:
//!
//! * The verification logics and the store where CCA trust anchors (CPAK) are
//! kept;
//! * The appraisal logics and the store where CCA Platform and Realm reference
//! values are kept.
//!
//! A simple, in-memory implementation of both stores is also provided by the
//! [`MemoRefValueStore`] and [`MemoTrustAnchorStore`] objects.
//!
//! # Examples
//!
//! * Initialise an in-memory store for reference values:
//!
//! ```
//! use ccatoken::store::MemoRefValueStore;
//!
//! let jrv = r#"
//! {
//! "platform": [
//! {
//! "implementation-id": "7f454c4602010100000000000000000003003e00010000005058000000000000",
//! "sw-components": [
//! {
//! "measurement-value": "07060504030201000f0e0d0c0b0a090817161514131211101f1e1d1c1b1a1918",
//! "signer-id": "07060504030201000f0e0d0c0b0a090817161514131211101f1e1d1c1b1a1918"
//! }
//! ],
//! "platform-configuration": "0107060504030201000f0e0d0c0b0a090817161514131211101f1e1d1c1b1a1918"
//! }
//! ],
//! "realm": [
//! {
//! "initial-measurement": "ff00000000000000000000000000000000000000000000000000000000000000",
//! "rak-hash-algorithm": "sha-256",
//! "extensible-measurements": [
//! "0000000000000000000000000000000000000000000000000000000000000001",
//! "0000000000000000000000000000000000000000000000000000000000000002",
//! "0000000000000000000000000000000000000000000000000000000000000003",
//! "0000000000000000000000000000000000000000000000000000000000000004"
//! ],
//! "personalization-value": "54686520717569636b2062726f776e20666f78206a756d7073206f766572203133206c617a7920646f67732e54686520717569636b2062726f776e20666f7820"
//! }
//! ]
//! }"#;
//!
//! let mut rvs: MemoRefValueStore = Default::default();
//!
//! rvs.load_json(&jrv).expect("loading reference values");
//! ```
//!
//! * Initialise an in-memory store for trust anchors:
//!
//! ```
//! use ccatoken::store::MemoTrustAnchorStore;
//!
//! let jta = r#"
//! [
//! {
//! "pkey": {
//! "crv": "P-256",
//! "kty": "EC",
//! "x": "TKRFE_RwSXooI8DdatPOYg_uiKm2XrtT_uEMEvqQZrw",
//! "y": "CRx3H8NHN1lcxqKi92P0OsZBxX3VFaktllpD3SjtN7s"
//! },
//! "implementation-id": "7f454c4602010100000000000000000003003e00010000005058000000000000",
//! "instance-id": "0107060504030201000f0e0d0c0b0a090817161514131211101f1e1d1c1b1a1918"
//! }
//! ]"#;
//!
//! let mut tas: MemoTrustAnchorStore = Default::default();
//!
//! tas.load_json(&jta).expect("loading trust anchors");
//! ```
pub use Cpak;
pub use Error;
pub use IRefValueStore;
pub use ITrustAnchorStore;
pub use MemoRefValueStore;
pub use MemoTrustAnchorStore;
pub use PlatformRefValue;
pub use SwComponent;
pub use RealmRefValue;
pub use RefValues;