Skip to main content

build_cmp_response

Function build_cmp_response 

Source
pub fn build_cmp_response(
    req: &CmpRequest,
    response_type: CmpMessageType,
    body: &[u8],
) -> Result<Vec<u8>, KipukaError>
Expand description

Build a DER-encoded CMP PKIMessage response.

Constructs a PKIMessage with:

  • header: sender, recipient, transactionID, senderNonce, recipNonce
  • body: the response content tagged with the response type
  • protection: signature computed with the CA signing key
  • extraCerts: CA certificate chain for validation

ยงErrors

  • KipukaError::BadRequest โ€” empty transaction ID or body.
  • KipukaError::Internal โ€” ASN.1 encoding not yet implemented.