Skip to content

Commit

Permalink
kbs-types: Add a key type field for publick keys
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sameo authored and tylerfanelli committed Jul 3, 2023
1 parent 7b025df commit 63a86ec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub struct Challenge {

#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct TeePubKey {
pub kty: String,
pub alg: String,
#[serde(rename = "n")]
pub k_mod: String,
Expand Down Expand Up @@ -130,6 +131,7 @@ mod tests {
let data = r#"
{
"tee-pubkey": {
"kty": "fakekeytype",
"alg": "fakealgorithm",
"n": "fakemodulus",
"e": "fakeexponent"
Expand All @@ -139,6 +141,7 @@ mod tests {

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

assert_eq!(attestation.tee_pubkey.kty, "fakekeytype");
assert_eq!(attestation.tee_pubkey.alg, "fakealgorithm");
assert_eq!(attestation.tee_pubkey.k_mod, "fakemodulus");
assert_eq!(attestation.tee_pubkey.k_exp, "fakeexponent");
Expand Down

0 comments on commit 63a86ec

Please sign in to comment.