Skip to main content

post_cmp

Function post_cmp 

Source
pub async fn post_cmp(
    __arg0: State<Arc<AppState>>,
    body: Bytes,
) -> Result<Response, KipukaError>
Expand description

POST /.well-known/cmp — process a CMP PKIMessage.

RFC 9810 §6.2: CMP messages are transported over HTTP using Content-Type: application/pkixcmp. The request and response bodies are DER-encoded PKIMessage values.

§Processing

  1. Validate Content-Type is application/pkixcmp.
  2. Parse the PKIMessage to extract message type and protection.
  3. Verify message protection (signature or MAC).
  4. Dispatch based on message type:
    • ir / cr → enrollment (certificate issuance)
    • kur → key update (re-enrollment)
    • rr → revocation
    • genm → general message (CA info, algorithms)
    • certConf → certificate confirmation
  5. Build and return the response PKIMessage.

§Errors

  • 400 Bad Request — malformed PKIMessage, unsupported type
  • 403 Forbidden — MAC verification failure, untrusted signer
  • 415 Unsupported Media Type — wrong Content-Type
  • 500 Internal Server Error — CA backend failure