Skip to content

Commit 3a126d1

Browse files
authored
Merge pull request #46 from 9elements/cleanup/example-cert-store
Minor cleanups of example cert store
2 parents e01b0b9 + 029a5a4 commit 3a126d1

1 file changed

Lines changed: 6 additions & 21 deletions

File tree

examples/platform/cert_store.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ use p384::{
2424
};
2525
use zerocopy::FromBytes;
2626

27-
use super::certs::{STATIC_END_CERT, STATIC_END_RESPONDER_KEY_DER, STATIC_INTER_CERT, STATIC_ROOT_CA_CERT};
27+
use super::certs::{
28+
STATIC_END_CERT, STATIC_END_RESPONDER_KEY_DER, STATIC_INTER_CERT, STATIC_ROOT_CA_CERT,
29+
};
2830
use spdm_lib::commands::challenge::MeasurementSummaryHashType;
2931
use spdm_lib::protocol::{
3032
algorithms::{AsymAlgo, ECC_P384_SIGNATURE_SIZE, SHA384_HASH_SIZE},
@@ -70,8 +72,8 @@ impl DemoCertStore {
7072
let raw_key: &[u8; 48] = STATIC_END_RESPONDER_KEY_DER[8..56]
7173
.try_into()
7274
.expect("key DER too short");
73-
let secret_key = SecretKey::from_bytes(raw_key.into())
74-
.expect("Failed to parse end-entity private key");
75+
let secret_key =
76+
SecretKey::from_bytes(raw_key.into()).expect("Failed to parse end-entity private key");
7577

7678
(cert_chain, SigningKey::from(secret_key))
7779
}
@@ -347,11 +349,7 @@ fn debug_signing_verification() {
347349
println!("except: print('✗ Sig1 invalid with SHA384')");
348350
}
349351

350-
pub struct ExamplePeerCertStrore {
351-
pub chain: Vec<u8>,
352-
}
353-
354-
#[derive(Debug)]
352+
#[derive(Debug, Default)]
355353
pub struct PeerSlot {
356354
/// CertChain[K], retrieved in `CERTIFICATE` response.
357355
pub cert_chain: Vec<u8>,
@@ -371,19 +369,6 @@ pub struct PeerSlot {
371369
pub requested_msh_type: Option<MeasurementSummaryHashType>,
372370
}
373371

374-
impl Default for PeerSlot {
375-
fn default() -> Self {
376-
PeerSlot {
377-
cert_chain: Vec::new(),
378-
digest: Vec::new(),
379-
keypair_id: None,
380-
certificate_info: None,
381-
key_usage_mask: None,
382-
requested_msh_type: None,
383-
}
384-
}
385-
}
386-
387372
impl PeerSlot {
388373
/// Get the digest for the root certificate of the chain
389374
///

0 commit comments

Comments
 (0)