question: @ Override boolean isPathCompleted ( X509Certificate cert ) { for ( TrustAnchor anchor : trustAnchors ) { if ( anchor . getTrustedCert ( ) != null ) { if ( cert . equals ( anchor . getTrustedCert ( ) ) ) { this . trustAnchor = anchor ; return true ; } else { continue ; } } X500Principal principal = anchor . getCA ( ) ; PublicKey publicKey = anchor . getCAPublicKey ( ) ; if ( principal != null && publicKey != null && principal . equals ( cert . getSubjectX500Principal ( ) ) ) { if ( publicKey . equals ( cert . getPublicKey ( ) ) ) { this . trustAnchor = anchor ; return true ; } } if ( principal == null || ! principal . equals ( cert . getIssuerX500Principal ( ) ) ) { continue ; } if ( PKIX . isDSAPublicKeyWithoutParams ( publicKey ) ) { continue ; } try { cert . verify ( publicKey , buildParams . sigProvider ( ) ) ; } catch ( InvalidKeyException ike ) { if ( debug != null ) { debug . println ( "ForwardBuilder.isPathCompleted() invalid " + "DSA key found" ) ; } continue ; } catch ( GeneralSecurityException e ) { if ( debug != null ) { debug . println ( "ForwardBuilder.isPathCompleted() " + "unexpected exception" ) ; e . printStackTrace ( ) ; } continue ; } this . trustAnchor = anchor ; return true ; } return false ; }
target:  Verifies whether the input certificate completes the path. Checks the cert against each trust anchor that was specified, in order, and returns true as soon as it finds a valid anchor. Returns true if the cert matches a trust anchor specified as a certificate or if the cert verifies with a trust anchor that was specified as a trusted {pubkey, caname} pair. Returns false if none of the trust anchors are valid for this cert.