MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / sign_cert_request

Function sign_cert_request

dstack-util/src/system_setup.rs:63–84  ·  view source on GitHub ↗
(
    cert_client: &CertRequestClient,
    key: &KeyPair,
    config: CertConfigV2,
)

Source from the content-addressed store, hash-verified

61use serde_json::Value;
62
63async fn sign_cert_request(
64 cert_client: &CertRequestClient,
65 key: &KeyPair,
66 config: CertConfigV2,
67) -> Result<Vec<String>> {
68 let pubkey = key.public_key_der();
69 let report_data = QuoteContentType::RaTlsCert.to_report_data(&pubkey);
70 let attestation = Attestation::quote(&report_data)
71 .context("Failed to get quote for cert pubkey")?
72 .into_versioned();
73 let csr = CertSigningRequestV2 {
74 confirm: "please sign cert:".to_string(),
75 pubkey,
76 config,
77 attestation,
78 };
79 let signature = csr.signed_by(key).context("Failed to sign the CSR")?;
80 cert_client
81 .sign_csr(&csr, &signature)
82 .await
83 .context("Failed to sign the CSR")
84}
85
86mod config_id_verifier;
87

Callers 1

Calls 4

to_report_dataMethod · 0.80
into_versionedMethod · 0.80
signed_byMethod · 0.45
sign_csrMethod · 0.45

Tested by

no test coverage detected