ark::crypt::X509Certificate

Defined in header “ark/crypt/certificate.hh”.


Forms a class suitable for constructing X509 certificates.

Methods

  • X509Certificate()
    Default constructor. Initializes a new certificate.

  • ~X509Certificate()
    Destructor, implemented privately to avoid leaking interfaces.

  • void set_public_key(const std::string & pem_public_key)
    Sets the public key for signing this certificate, in the PEM format.

  • void add_text_entry(const std::string & key, const std::string & value)
    Sets an entry by text to the certificate. For example, ‘CN’ for common name. Uses the subject name.

  • std::string get_text_entry(const std::string & key)
    Returns the entry with the given key for this certificate, as a string.

  • void set_validity_period(std::chrono::seconds not_before, std::chrono::seconds not_after)
    Sets the validity period, relative to current gmtime.

  • void self_sign(const std::string & pem_private_key)
    Signs the certificate with the given private key, assuming that it matches the public key previously set.

  • std::string pem_str()
    Returns the current X509 certificate as a PEM-encoded string.