@@ -239,6 +239,9 @@ The JCE provider currently supports the following algorithms:
239239 CertPathValidator Class
240240 PKIX (with PKIXRevocationChecker via getRevocationChecker())
241241
242+ CertPathBuilder Class
243+ PKIX
244+
242245 SecretKeyFactory
243246 PBKDF2WithHmacSHA1
244247 PBKDF2WithHmacSHA224
@@ -563,6 +566,77 @@ Applications should use TrustAnchors without explicit name constraints; if
563566name constraint enforcement is needed, the constraints should be embedded in
564567the trust anchor certificate itself.
565568
569+ ### CertPathBuilder (PKIX) Implementation Notes
570+ ---------
571+
572+ wolfJCE provides a PKIX CertPathBuilder implementation that builds and
573+ validates certificate chains using native wolfSSL's
574+ ` wolfSSL_X509_verify_cert() ` function.
575+
576+ #### Native Chain Building with Backtracking
577+
578+ The CertPathBuilder uses native wolfSSL ` X509_STORE ` APIs for certificate chain
579+ building. This provides automatic backtracking when a candidate issuer fails
580+ verification. wolfSSL will try alternative issuers until a valid path is found
581+ or all possibilities are exhausted.
582+
583+ #### Usage Example
584+
585+ ``` java
586+ /* Load certificates */
587+ X509Certificate targetCert = ... ;
588+ X509Certificate intermediateCert = ... ;
589+ X509Certificate rootCACert = ... ;
590+
591+ /* Set up trust anchors */
592+ Set<TrustAnchor > anchors = new HashSet<> ();
593+ anchors. add(new TrustAnchor (rootCACert, null ));
594+
595+ /* Set up CertStore with available certificates */
596+ Collection<Certificate > certs = new ArrayList<> ();
597+ certs. add(targetCert);
598+ certs. add(intermediateCert);
599+ CertStore certStore = CertStore . getInstance(" Collection" ,
600+ new CollectionCertStoreParameters (certs));
601+
602+ /* Configure parameters */
603+ X509CertSelector selector = new X509CertSelector ();
604+ selector. setCertificate(targetCert);
605+ PKIXBuilderParameters params = new PKIXBuilderParameters (anchors, selector);
606+ params. setRevocationEnabled(false );
607+ params. addCertStore(certStore);
608+
609+ /* Build certificate path */
610+ CertPathBuilder cpb = CertPathBuilder . getInstance(" PKIX" , " wolfJCE" );
611+ PKIXCertPathBuilderResult result = (PKIXCertPathBuilderResult ) cpb. build(params);
612+
613+ CertPath certPath = result. getCertPath();
614+ TrustAnchor trustAnchor = result. getTrustAnchor();
615+ ```
616+
617+ #### Supported Features
618+
619+ - RSA and ECC certificate chains
620+ - Multiple intermediate certificates
621+ - Multiple trust anchors (correct one selected automatically)
622+ - Multiple CertStores
623+ - ` maxPathLength ` constraint enforcement
624+ - Target certificate selection by certificate or subject name
625+ - Target certificate as trust anchor (returns empty path)
626+
627+ #### Limitations
628+
629+ - ** Date Override** : ` PKIXBuilderParameters.setDate() ` is not passed to native
630+ wolfSSL verification. Certificates are validated against current system time.
631+ - ** TrustAnchor Name Constraints** : Name constraints on TrustAnchors are not
632+ supported. An ` InvalidAlgorithmParameterException ` is thrown if any
633+ TrustAnchor has name constraints set.
634+ - ** Policy Processing** : Certificate policy processing is not supported.
635+ ` PKIXCertPathBuilderResult.getPolicyTree() ` returns null.
636+ - ** Revocation Checking** : Revocation checking during path building is not
637+ currently integrated. Use ` CertPathValidator ` with ` PKIXRevocationChecker `
638+ for revocation checking after path building.
639+
566640### Behavior Discrepancies with SunJCE
567641---------
568642
0 commit comments