cert
pg_cert · PostgreSQL data types and functions for X.509 certificates, certificate requests, and related OpenSSL objects.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100169 | cert | pg_cert | 0.1.1 | TYPE | PostgreSQL | C |
| Relationships | |
|---|---|
| Requires | bignum |
Usage
Sources:
cert 0.1.1 adds PostgreSQL types for OpenSSL-format X.509 certificates, certificate requests, and DSA parameters, plus functions that extract certificate metadata. Upstream describes the implementation as preliminary and not intended for production use.
Core Workflow
The install SQL requires the bignum extension. Store PEM certificates in a cert column, then use the accessor functions in ordinary queries:
Values are supplied through the cert input function as complete OpenSSL PEM certificates. Invalid or unsupported certificate text is rejected by the C input routine.
Important Objects
certstores an X.509 certificate;cert_reqstores a certificate request.basic_cert_infois a composite of serial number, validity interval, issuer, and subject;get_basic_info(cert)returns it.get_version(cert),get_serial_number(cert),get_not_before(cert),get_not_after(cert),get_issuer(cert), andget_subject(cert)expose basic certificate fields.get_signature(cert),get_issuer_hash(cert),get_iands_hash(cert),get_common_name(cert),get_subject_hash(cert), andget_subject_keyid_hash(cert)expose additional text properties.dsa_params,size(dsa_params), andgenerate_dsa_params(integer)support DSA parameter storage and generation.
Operational Notes
Only OpenSSL-format input is supported. The SQL comments note that issuer and subject currently return text rather than a distinguished-name type, and several public-key operations remain unimplemented. The C module links against OpenSSL and the install script creates bignum; verify both dependencies on the target PostgreSQL build. Do not treat stored certificates as automatically validated trust objects: the documented API parses and inspects them, but upstream does not document chain validation or revocation checking.