pkixops-pki

pkixops-pki provides practical PKI lifecycle building blocks: issuing certificate chains, renewing/re-issuing leaf certificates, tracking revocations, and publishing CRLs.

Designed for Java/Spring services that need consistent PKI operations.

Features

Certificate Issuance (Chain)

Renewal vs Re-Issue

Revocation + Publishing

Installation (Maven)

<dependency>
      <groupId>com.pkixops</groupId>
      <artifactId>pkixops-pki</artifactId>
      <version>1.7.0</version>
    </dependency>

Issuing a Root / Intermediate / Leaf Chain

Key pairs

You can choose RSA or EC curves depending on your policy.

Example PKIXOps pattern:

Root CA (self-signed)

Intermediate CA (signed by Root)

Leaf certificate (signed by Intermediate)

What is dnsSans?

dnsSans is typically a list of DNS names placed into the certificate’s Subject Alternative Name extension for TLS server certificates (e.g., example.com).

Can it be removed for personal/client certificates?

Yes. For non-server certificates, you often use:

If EKU is serverAuth, SAN is strongly recommended for modern TLS validation. For clientAuth/personal identity certificates, SAN may be optional or use different SAN types.

Renewal (Recommended: Key Rollover)

Re-Issue (Allow Changes + Optional Revocation)

A re-issue workflow may allow changes within policy limits:

Revocation Store: revoked.json

Simple implementations store revocation events into:

Each entry typically includes serial, revokedAt, reason, subject/issuer, validity, and SHA-256 fingerprint.

CRL Publishing

A CRL publisher reads revoked.json and emits:

In production, CRL publication should be scheduled and distributed via HTTP/CDN, and CRL Distribution Points (CDP) should point to the published URL.

Spring Boot Integration Notes

Do not write to src/main/resources at runtime.
Classpath resources are packaged into the application artifact and are read-only in most deployments. Write to an external directory configured via application.yml.
pkixops:
      cert-store-dir: /var/lib/pkixops/certs
      crl-store-dir: /var/lib/pkixops/crls

Example: Issue Leaf Using Intermediate from Classpath PKCS#12

ClassPathResource p12Res = new ClassPathResource("cert/intermediate.p12");

      P12IO.KeyMaterial km;
      try (InputStream in = p12Res.getInputStream()) {
        km = P12IO.readFirstKeyEntry(in, INT_PASSWORD);
      }

      X509Certificate intCert = km.certificate;
      PrivateKey intKey = km.privateKey;

      KeyPair leafKp = LEAF256.genEcP256();
      X509Certificate leafCert = LEAF256.issueLeafServer(
        leafKp,
        leafDn,
        intCert,
        intKey,
        leafDays,
        new String[] {}
      );

      String leafPem = PemUtil.toPem(leafCert);

License

The Apache License, Version 2.0