Package java.security.cert

Examples of java.security.cert.CertificateException


  public void checkServerTrusted(X509Certificate[] arg0, String arg1)
    throws CertificateException
  {
    if (DSA.equals(arg0[0]) || RSA.equals(arg0[0]))
      return;
    throw new CertificateException();
  }
View Full Code Here


      throw new IllegalArgumentException(JarVerifierMessages.Cert_Verifier_Illegal_Args);
    }
    KeyStores stores = getKeyStores();
    // stores == null when the supportFlags includes the VERIFY_TRUST flag
    if (stores != null && !stores.isTrusted(certChain[certChain.length - 1])) {
      throw new CertificateException(NLS.bind(JarVerifierMessages.Cert_Verifier_Not_Trusted, new String[] {certChain[0].toString()}));
    }
  }
View Full Code Here

        return keystores.size();
    }

    public void checkClientTrusted(X509Certificate[] certs, String alg) throws CertificateException {
        if (!isTrusted(certs)) {
            throw new CertificateException("No trusted certificate found");
        }
    }
View Full Code Here

        }
    }

    public void checkServerTrusted(X509Certificate[] certs, String alg) throws CertificateException {
        if (!isTrusted(certs)) {
            throw new CertificateException("No trusted certificate found");
        }
    }
View Full Code Here

      serverPrincipal = serverCredential.getSubjectX500Principal();
      setPermittedRemotePrincipals(
    Collections.singleton(serverPrincipal));
      credentialsValidUntil = certificatesValidUntil(chain);
  } else if (!serverCredential.equals(chain[0])) {
      throw new CertificateException("Server credentials changed");
  }
    }
View Full Code Here

                            cert.verify(certificates[count].getPublicKey()) ;
                            return ;
                        }
                        catch (final Exception ex) {} // ignore and try next certificate
                    }
                    throw new CertificateException("Failed to verify certificate") ;
                }
            }
View Full Code Here

            try {
              CVCertificate parsedObject = CertificateParser.parseCertificate(cert);
              ret = new CardVerifiableCertificate(parsedObject);
      } catch (ParseException e) {
            log.debug("ParseException trying to read CVCCertificate.");
            throw new CertificateException("Certificate exception trying to read CVCCertificate", e);
      } catch (ConstructionException e) {
            log.debug("ConstructionException trying to read CVCCertificate.");
            throw new CertificateException("Certificate exception trying to read CVCCertificate", e);
      } catch (IllegalArgumentException e) {
            log.debug("CertificateException trying to read CVCCertificate.");
            throw new CertificateException("Certificate exception trying to read CVCCertificate", e);
      }
        }
        if (ret == null) {
          throw new CertificateException("No certificate found");
        }
        //log.trace("<getCertfromByteArray");
        return ret;
    } // getCertfromByteArray
View Full Code Here

        //XXX cache found certs ??
        Certificate x509 = ks.getCertificate(alias);
        if (x509 instanceof X509Certificate) {
            return ((X509Certificate) x509).getSubjectX500Principal();
        } else {
            throw new CertificateException(Messages.getString("security.148", //$NON-NLS-1$
                    alias, x509));
        }
    }
View Full Code Here

        int size = certs.size();
        certificates = new ArrayList(size);
        for (int i=0; i<size; i++) {
            Object cert = certs.get(i);
            if (!(cert instanceof X509Certificate) ) {
                throw new CertificateException(
                        Messages.getString("security.15D")); //$NON-NLS-1$
            }
            certificates.add(cert);
        }
    }
View Full Code Here

    public static X509CertPathImpl getInstance(InputStream in)
                                        throws CertificateException {
        try {
            return (X509CertPathImpl) ASN1.decode(in);
        } catch (IOException e) {
            throw new CertificateException(Messages.getString("security.15E", //$NON-NLS-1$
                    e.getMessage()));
        }
    }
View Full Code Here

TOP

Related Classes of java.security.cert.CertificateException

Copyright © 2018 www.massapicom. 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.