How qrn12580/java-ca works
Project type and purpose
• This is a single‐service backend application written in Java using Spring Boot.
• Purpose: Provide HTTP endpoints for issuing X.509 certificates signed by a root CA and for returning the root CA certificate. It also offers utility functions for certificate validation and conversion.
File structure
• pom.xml: Defines dependencies (Spring Boot, Knife4j/Swagger, JUnit).
• src/main/java/com/bjut/ca
• CaApplication.java – Spring Boot entry point.
• Config/Knife4jConfig.java – Swagger UI configuration.
• server/controller/CA.java – REST controller exposing /ca and /root-ca endpoints.
• server/impl/CAimpl.java – Core service implementing certificate issuance logic.
• Util/*.java – Helper classes:
– PublicKeyUtil: decode/encode user public keys
– X509CertificateUtil: create and load X.509 certificates
– CertificateValidator: validate certificates against root CA
• ca_keystore.p12 (at project root) and application.yml in resources: Store root CA private key and config.
• src/test: Unit tests for application startup and utilities.
README for additional insights
• Endpoints:
• POST /ca: Request userDN and Base64‐encoded userPublicKey → Returns signed CA certificate (Base64).
• GET /root-ca: Returns Base64‐encoded root CA certificate.
• Certificate validation APIs in CertificateValidator.
• Conversion utilities for PublicKey ↔ Base64 string, String ↔ X509Certificate.
Detail
• Every package or layer as its own component.
• Data transformation steps (Base64 encoding/decoding).
• Don’t over‐generalize—display each major class or module so stakeholders can see where to locate functionality in code.