Package java.security.cert

Examples of java.security.cert.CertPathValidator.validate()


            if (provider == null || provider.length() == 0) {
                validator = CertPathValidator.getInstance("PKIX");
            } else {
                validator = CertPathValidator.getInstance("PKIX", provider);
            }
            validator.validate(path, param);
        } catch (NoSuchProviderException e) {
                throw new WSSecurityException(
                    WSSecurityException.ErrorCode.FAILURE, "certpath",
                    e
                );
View Full Code Here


            if (provider == null || provider.length() == 0) {
                validator = CertPathValidator.getInstance("PKIX");
            } else {
                validator = CertPathValidator.getInstance("PKIX", provider);
            }
            validator.validate(path, param);
        } catch (java.security.NoSuchProviderException e) {
                throw new WSSecurityException(
                    WSSecurityException.ErrorCode.FAILURE, "certpath",
                    e.getMessage(), e
                );
View Full Code Here

         throw new WSSecurityException("Problems setting up certificate validation", e);
      }

      try
      {
         cpv.validate(cp, parameters);
      }
      catch (CertPathValidatorException cpve)
      {
         log.debug("Certificate is invalid:", cpve);
         throw new FailedAuthenticationException();
View Full Code Here

        CertPathValidator cpv = CertPathValidator.getInstance("PKIX","BC");
        PKIXParameters param = new PKIXParameters(trust);
        param.addCertStore(store);
        param.setDate(validDate.getTime());
        PKIXCertPathValidatorResult result =
            (PKIXCertPathValidatorResult) cpv.validate(cp, param);
        PolicyNode policyTree = result.getPolicyTree();
        PublicKey subjectPublicKey = result.getPublicKey();

        //
        // invalid path containing a valid one test
View Full Code Here

            param = new PKIXParameters(trust);
            param.addCertStore(store);
            param.setRevocationEnabled(false);
            param.setDate(validDate.getTime());
           
            result =(PKIXCertPathValidatorResult) cpv.validate(cp, param);
            policyTree = result.getPolicyTree();
            subjectPublicKey = result.getPublicKey();
           
            fail("Invalid path validated");
        }
View Full Code Here

        CertPathValidatorSpi spi = new MyCertPathValidatorSpi();
        CertPathValidator certPV = new myCertPathValidator(spi,
                    defaultProvider, defaultType);
        assertEquals("Incorrect algorithm", certPV.getAlgorithm(), defaultType);
        assertEquals("Incorrect provider", certPV.getProvider(), defaultProvider);
        certPV.validate(null, null);
        try {
            certPV.validate(null, null);
            fail("CertPathValidatorException must be thrown");
        } catch (CertPathValidatorException e) {
        }       
View Full Code Here

                    defaultProvider, defaultType);
        assertEquals("Incorrect algorithm", certPV.getAlgorithm(), defaultType);
        assertEquals("Incorrect provider", certPV.getProvider(), defaultProvider);
        certPV.validate(null, null);
        try {
            certPV.validate(null, null);
            fail("CertPathValidatorException must be thrown");
        } catch (CertPathValidatorException e) {
        }       
        certPV = new myCertPathValidator(null, null, null);
        assertNull("Incorrect algorithm", certPV.getAlgorithm());
View Full Code Here

        }       
        certPV = new myCertPathValidator(null, null, null);
        assertNull("Incorrect algorithm", certPV.getAlgorithm());
        assertNull("Incorrect provider", certPV.getProvider());
        try {
            certPV.validate(null, null);
            fail("NullPointerException must be thrown");
        } catch (NullPointerException e) {
        }
    }
    public static void main(String args[]) {
View Full Code Here

            if (provider == null || provider.length() == 0) {
                certPathValidator = CertPathValidator.getInstance("PKIX");
            } else {
                certPathValidator = CertPathValidator.getInstance("PKIX", provider);
            }
            certPathValidator.validate(path, param);
        } catch (NoSuchProviderException ex) {
            throw new WSSecurityException(WSSecurityException.FAILURE,
                    "certpath", new Object[] { ex.getMessage() },
                    (Throwable) ex);
        } catch (NoSuchAlgorithmException ex) {
View Full Code Here

                }
            }
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
            certPath = cf.generateCertPath(certChainList);
            certValidator = CertPathValidator.getInstance("PKIX");
            certValidator.validate(certPath, parameters);

        } catch (CertPathValidatorException ex) {
            securityLogger.log(Level.SEVERE, null, ex);
            throw new CertificateException(ex);
        } catch (NoSuchAlgorithmException 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.