Examples of CertPathValidator


Examples of java.security.cert.CertPathValidator

                }
            }
        }

        // Validate the certificate path.
        CertPathValidator validator = CertPathValidator.getInstance("PKIX");
        validator.validate(path, parameters);

        // Return the certificate path.
        return path;
    }
View Full Code Here

Examples of java.security.cert.CertPathValidator

                    CertStoreParameters crlParams = new CollectionCertStoreParameters(crls);
                    pkixParams.addCertStore(CertStore.getInstance("Collection", crlParams));
                }
            }
               
            CertPathValidator validator = CertPathValidator.getInstance("PKIX");
            validator.validate(certPath, pkixParams);
           
        } catch (InvalidAlgorithmParameterException e) {
            LOG.log(Level.WARNING,
                    "Invalid algorithm parameter by certificate chain validation. "
                        + "It is likely that issuer certificates are not found in XKMS trusted storage. "
View Full Code Here

Examples of java.security.cert.CertPathValidator

            // Do not check a revocation list
            param.setRevocationEnabled(false);

            // Verify the trust path using the above settings           
            CertPathValidator certPathValidator = CertPathValidator.getInstance("PKIX");
            certPathValidator.validate(path, param);
        } catch (NoSuchAlgorithmException ex) {
            throw new WSSecurityException(WSSecurityException.FAILURE,
                    "certpath",
                    new Object[]{ex.getMessage()},
                    (Throwable) ex);
View Full Code Here

Examples of java.security.cert.CertPathValidator

            CertPath cp = CertificateFactory.getInstance("X.509","BC").generateCertPath(certchain);

            Set<TrustAnchor> trust = new HashSet<TrustAnchor>();
            trust.add(new TrustAnchor(rootCert, null));

            CertPathValidator cpv = CertPathValidator.getInstance("PKIX","BC");
            PKIXParameters param = new PKIXParameters(trust);
            param.addCertStore(store);
            param.setDate(new Date());                 
            param.setRevocationEnabled(false);

            cpv.validate(cp, param);
          }else{
            throw new XKMSResponseSignatureException("Error XKMS request signature doesn't verify.");           
          }
        }catch(Exception e){         
          throw new XKMSResponseSignatureException("Error when verifying signature request.",e);
View Full Code Here

Examples of java.security.cert.CertPathValidator

          // Disable CRL checking since we are not supplying any CRLs
          params.setRevocationEnabled(false);
          params.setDate( new Date() );

          // Create the validator and validate the path
          CertPathValidator certPathValidator = CertPathValidator.getInstance(CertPathValidator.getDefaultType(), "BC");
          CertificateFactory fact = CertTools.getCertificateFactory();
          CertPath certpath = fact.generateCertPath(calist);

          CertPathValidatorResult result = certPathValidator.validate(certpath, params);

          // Get the certificates validate in the path
          PKIXCertPathValidatorResult pkixResult = (PKIXCertPathValidatorResult)result;
          returnval.addAll(certpath.getCertificates());
View Full Code Here

Examples of java.security.cert.CertPathValidator

        PKIXCertPathBuilderResult cpbResult =
            (PKIXCertPathBuilderResult) cpb.build(cpbParams);
        CertPath certPath = cpbResult.getCertPath();

        // Validate path
        final CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
        final PKIXParameters params = new PKIXParameters(anchors);
        params.setSigProvider("BC");
        params.setRevocationEnabled(false);
//                X509CertSelector targetCertConstraints = new X509CertSelector();
//                targetCertConstraints.setKeyUsage(keyUsage)
//                params.setTargetCertConstraints(targetCertConstraints);

        PKIXCertPathValidatorResult result =
            (PKIXCertPathValidatorResult) cpv.validate(certPath, params);
//                PolicyNode policyTree = result.getPolicyTree();
//                PublicKey subjectPublicKey = result.getPublicKey();
        if (LOG.isDebugEnabled()) {
            LOG.debug("Found trust anchor: " + result.getTrustAnchor());
        }
View Full Code Here

Examples of java.security.cert.CertPathValidator

              CertPath cp = CertificateFactory.getInstance("X.509","BC").generateCertPath(certchain);

              Set trust = new HashSet();
              trust.add(new TrustAnchor(rootCert, null));

              CertPathValidator cpv = CertPathValidator.getInstance("PKIX","BC");
              PKIXParameters param = new PKIXParameters(trust);
              param.addCertStore(store);
              param.setDate(new Date());                 
              param.setRevocationEnabled(false);

              cpv.validate(cp, param);

              // Check revocation status
              boolean revoked = certificateStoreSession.isRevoked(CertTools.getIssuerDN(verCert), verCert.getSerialNumber());
              if (revoked) {
                return false;
View Full Code Here

Examples of java.security.cert.CertPathValidator

       CertPath cp = CertificateFactory.getInstance("X.509","BC").generateCertPath(certchain);
      
       Set trust = new HashSet();
       trust.add(new TrustAnchor(rootCert, null));
      
       CertPathValidator cpv = CertPathValidator.getInstance("PKIX","BC");
       PKIXParameters param = new PKIXParameters(trust);
       param.addCertStore(store);
       param.setDate(new Date());
       if(trustedCRLs == null){
         param.setRevocationEnabled(false);
       }else{
         param.setRevocationEnabled(true);
       }
       cpv.validate(cp, param);
       retval = true;
     }catch(Exception e){
       log.error(intres.getLocalizedMessage("xkms.errorverifyingcert"),e);     

     }
View Full Code Here

Examples of java.security.cert.CertPathValidator

          CertPath cp = CertificateFactory.getInstance("X.509","BC").generateCertPath(certchain);
         
          Set trust = new HashSet();
          trust.add(new TrustAnchor(rootCert, null));
         
          CertPathValidator cpv = CertPathValidator.getInstance("PKIX","BC");
          PKIXParameters param = new PKIXParameters(trust);
          param.addCertStore(store);
          param.setDate(date);
          if(trustedCRLs == null){
            param.setRevocationEnabled(false);
          }else{
            param.setRevocationEnabled(true);
          }
          cpv.validate(cp, param);
          retval = new ParsedSignatureResult(verifies, usercert,content);
        }catch(Exception e){
      log.error("Error verifying data : ", e);
    }
View Full Code Here

Examples of java.security.cert.CertPathValidator

            // Do not check a revocation list
            param.setRevocationEnabled(false);

            // Verify the trust path using the above settings           
            CertPathValidator certPathValidator = CertPathValidator.getInstance("PKIX");
            certPathValidator.validate(path, param);
        } catch (NoSuchAlgorithmException ex) {
            throw new WSSecurityException(WSSecurityException.FAILURE,
                    "certpath",
                    new Object[]{ex.getMessage()},
                    (Throwable) ex);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.