Skip to content

Commit d68aa16

Browse files
sarroutbiansasaki
authored andcommitted
Recover key_class field and set it as "asymmetric"
Resolves: #967 Signed-off-by: Sergio Arroutbi <[email protected]>
1 parent 4a55074 commit d68aa16

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

keylime/src/structures/capabilities_negotiation.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ pub struct ShaValues {
7070
#[derive(Serialize, Deserialize, Debug, Clone)]
7171
pub struct CertificationKey {
7272
pub key_algorithm: String,
73+
pub key_class: String,
7374
pub key_size: u32,
7475
pub server_identifier: String,
7576
pub local_identifier: String,
@@ -194,6 +195,7 @@ mod tests {
194195
},
195196
certification_keys: vec![
196197
CertificationKey {
198+
key_class: "asymmetric".to_string(),
197199
local_identifier: "att_local_identifier".to_string(),
198200
key_algorithm: "rsa".to_string(),
199201
key_size: 2048,
@@ -244,6 +246,7 @@ mod tests {
244246
"certification_keys": [
245247
{
246248
"key_algorithm": "rsa",
249+
"key_class": "asymmetric",
247250
"key_size": 2048,
248251
"server_identifier": "ak",
249252
"local_identifier": "att_local_identifier",
@@ -352,6 +355,7 @@ mod tests {
352355
},
353356
certification_keys: vec![
354357
CertificationKey {
358+
key_class: "asymmetric".to_string(),
355359
key_size: 2048,
356360
server_identifier: "ak".to_string(),
357361
local_identifier: "att_local_identifier".to_string(),
@@ -422,6 +426,7 @@ mod tests {
422426
"certification_keys": [
423427
{
424428
"key_algorithm": "rsa",
429+
"key_class": "asymmetric",
425430
"key_size": 2048,
426431
"server_identifier": "ak",
427432
"local_identifier": "att_local_identifier",
@@ -480,9 +485,10 @@ mod tests {
480485
"signature_schemes":["rsassa"],
481486
"available_subjects":{"sha1":[1,2,3],
482487
"sha256":[4,5,6]},
483-
"certification_keys":[{"key_algorithm":"rsa",
488+
"certification_keys":[{"key_class":"asymmetric",
489+
"local_identifier":"att_local_identifier",
490+
"key_algorithm":"rsa",
484491
"key_size":2048,
485-
"local_identifier":"att_local_identifier",
486492
"server_identifier":"ak",
487493
"public":"OTgtMjkzODQ1LTg5MjMtNDk1OGlrYXNkamZnO2Frc2pka2ZqYXM7a2RqZjtramJrY3hqejk4MS0zMjQ5MDhpLWpmZDth"}]}},
488494
{"evidence_class":"log",
@@ -531,6 +537,7 @@ mod tests {
531537
capabilities.certification_keys.first();
532538
assert!(some_certification_keys.is_some());
533539
let certification_key = some_certification_keys.unwrap(); //#[allow_ci]
540+
assert_eq!(certification_key.key_class, "asymmetric");
534541
assert_eq!(
535542
certification_key.local_identifier,
536543
"att_local_identifier"
@@ -659,6 +666,7 @@ mod tests {
659666
hash_algorithm: Some("sha384".to_string()),
660667
signature_scheme: Some("rsassa".to_string()),
661668
certification_key: Some(CertificationKey {
669+
key_class: "asymmetric".to_string(),
662670
key_size: 2048,
663671
server_identifier: "ak".to_string(),
664672
local_identifier: "att_local_identifier".to_string(),
@@ -686,6 +694,7 @@ mod tests {
686694
"chosen_parameters": {
687695
"certification_key": {
688696
"key_algorithm": "rsa",
697+
"key_class": "asymmetric",
689698
"key_size": 2048,
690699
"local_identifier": "att_local_identifier",
691700
"public": "OTgtMjkzODQ1LTg5MjMtNDk1OGlrYXNkamZnO2Frc2pka2ZqYXM7a2RqZjtramJrY3hqejk4MS0zMjQ5MDhpLWpmZDth",
@@ -732,6 +741,7 @@ mod tests {
732741
hash_algorithm: Some("sha384".to_string()),
733742
signature_scheme: Some("rsassa".to_string()),
734743
certification_key: Some(CertificationKey {
744+
key_class: "asymmetric".to_string(),
735745
key_size: 2048,
736746
server_identifier: "ak".to_string(),
737747
local_identifier: "att_local_identifier".to_string(),
@@ -777,6 +787,7 @@ mod tests {
777787
"chosen_parameters": {
778788
"certification_key": {
779789
"key_algorithm": "rsa",
790+
"key_class": "asymmetric",
780791
"key_size": 2048,
781792
"local_identifier": "att_local_identifier",
782793
"public": "OTgtMjkzODQ1LTg5MjMtNDk1OGlrYXNkamZnO2Frc2pka2ZqYXM7a2RqZjtramJrY3hqejk4MS0zMjQ5MDhpLWpmZDth",
@@ -843,6 +854,7 @@ mod tests {
843854
"sha256": [4, 5, 6]
844855
},
845856
"certification_key": {
857+
"key_class": "asymmetric",
846858
"key_algorithm": "rsa",
847859
"key_size": 2048,
848860
"server_identifier": "ak",
@@ -905,6 +917,7 @@ mod tests {
905917
);
906918
let certification_key =
907919
params.certification_key.as_ref().unwrap(); //#[allow_ci]
920+
assert_eq!(certification_key.key_class, "asymmetric");
908921
assert_eq!(certification_key.local_identifier, "local_id");
909922
assert_eq!(certification_key.key_algorithm, "rsa");
910923
assert_eq!(certification_key

0 commit comments

Comments
 (0)