Skip to content

Commit 63a86ec

Browse files
sameotylerfanelli
authored andcommitted
kbs-types: Add a key type field for publick keys
Both EC and RSA JWK-formatted public keys must specify a key type through the `kty` type. See https://www.rfc-editor.org/rfc/rfc7518.html#section-6 for further reference. Signed-off-by: Samuel Ortiz <sameo@rivosinc.com>
1 parent 7b025df commit 63a86ec

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub struct Challenge {
4040

4141
#[derive(Clone, Serialize, Deserialize, Debug)]
4242
pub struct TeePubKey {
43+
pub kty: String,
4344
pub alg: String,
4445
#[serde(rename = "n")]
4546
pub k_mod: String,
@@ -130,6 +131,7 @@ mod tests {
130131
let data = r#"
131132
{
132133
"tee-pubkey": {
134+
"kty": "fakekeytype",
133135
"alg": "fakealgorithm",
134136
"n": "fakemodulus",
135137
"e": "fakeexponent"
@@ -139,6 +141,7 @@ mod tests {
139141

140142
let attestation: Attestation = serde_json::from_str(data).unwrap();
141143

144+
assert_eq!(attestation.tee_pubkey.kty, "fakekeytype");
142145
assert_eq!(attestation.tee_pubkey.alg, "fakealgorithm");
143146
assert_eq!(attestation.tee_pubkey.k_mod, "fakemodulus");
144147
assert_eq!(attestation.tee_pubkey.k_exp, "fakeexponent");

0 commit comments

Comments
 (0)