Skip to content

ECertFormat

Jay edited this page Oct 3, 2026 · 2 revisions

ECertFormat

#include <certpp/x509/cert.hpp> --- certpp::x509

Enumerators

Enumerator Value Meaning
ECERT_AUTO 0 Automatically detect the certificate format.
ECERT_DER DER-encoded certificate.
ECERT_PEM PEM-encoded certificate.

Example

ECERT_AUTO, the default, sniffs DER from PEM out of the data itself, which is what to pass for a file whose format is not known up front. It is an import-only value: exportAs() has nothing to detect from and reports ERET_NOTSUP, so an export must name ECERT_DER or ECERT_PEM.

// given: const SReadOnlyByteSpan& fileContents
CCert cert;
if (cert.importFrom(fileContents, ECERT_AUTO) != ERET_OK) {
    return;
}

COctet pem;
if (cert.exportAs(pem, false, ECERT_PEM) != ERET_OK) {
    return;
}
// pem holds a "-----BEGIN CERTIFICATE-----" block; ECERT_AUTO here would have been ERET_NOTSUP

Reference generated from certpp/x509/cert.hpp at commit 0834b29 (v1.0.1). The header is authoritative --- if this page disagrees with it, the header is right and this page needs regenerating.

Clone this wiki locally