Examples of generateCertPath()


Examples of java.security.cert.CertificateFactory.generateCertPath()

                    ArrayList<Certificate> certList = new ArrayList<Certificate>();
                      certList.add(cert);
                      certList.addAll(caSession.getCA(Admin.getInternalAdmin(), CertTools.getIssuerDN(cert).hashCode()).getCertificateChain());
                      // Create large certificate-only PKCS7
                      CertificateFactory cf = CertificateFactory.getInstance("X.509");
                      CertPath certPath = cf.generateCertPath(new ByteArrayInputStream(CertTools.getPEMFromCerts(certList)));
                      result = certPath.getEncoded("PKCS7");
              } else
              return new CertificateRequestResponse(submessage.getRequestId(), false, MSG_UNSUPPORTED_RESPONSE_TYPE, null, null);
              }
              break;
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

                    ArrayList<Certificate> certList = new ArrayList<Certificate>();
                      certList.add(cert);
                      certList.addAll(caSession.getCA(Admin.getInternalAdmin(), CertTools.getIssuerDN(cert).hashCode()).getCertificateChain());
                      // Create large certificate-only PKCS7
                      CertificateFactory cf = CertificateFactory.getInstance("X.509");
                      CertPath certPath = cf.generateCertPath(new ByteArrayInputStream(CertTools.getPEMFromCerts(certList)));
                      result = certPath.getEncoded("PKCS7");
              } else {
              return new CertificateRequestResponse(submessage.getRequestId(), false, MSG_UNSUPPORTED_RESPONSE_TYPE, null, null);
              }
              break;
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

        throws WSSecurityException {
        InputStream in = new ByteArrayInputStream(data);
        CertPath path = null;
        try {
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            path = factory.generateCertPath(in);
        } catch (CertificateException e) {
            throw new WSSecurityException(
                WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, "parseError", null, e
            );
        }
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

                list.add(certs[i]);
            }
        }
        try {
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            CertPath path = factory.generateCertPath(list);
            return path.getEncoded();
        } catch (CertificateEncodingException e) {
            throw new WSSecurityException(
                WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, "encodeError", null, e
            );
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

        try {
            // Generate cert path
            List certList = Arrays.asList(certs);
            CertificateFactory factory = CertificateFactory.getInstance("X.509");
            CertPath path = factory.generateCertPath(certList);

            // Use the certificates in the keystore as TrustAnchors
            PKIXParameters param = new PKIXParameters(this.keystore);

            // Do not check a revocation list
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

                abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(x509Certificates[0].getEncoded()));
            } else {
                try {
                    CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509", "BC");
                    List<X509Certificate> certificates = Arrays.asList(x509Certificates);
                    abstractOutputProcessor.createCharactersAndOutputAsEvent(outputProcessorChain, new Base64(76, new byte[]{'\n'}).encodeToString(certificateFactory.generateCertPath(certificates).getEncoded()));
                } catch (CertificateException e) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
                } catch (NoSuchProviderException e) {
                    throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e);
                }
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

      CertPathValidator validator = CertPathValidator.getInstance(VALIDATOR_TYPE);
      PKIXParameters params = new PKIXParameters(trustRoots);
      params.setDate(timeSource.now());
      params.setRevocationEnabled(false);
      CertificateFactory certFactory = CertificateFactory.getInstance(CERTIFICATE_TYPE);
      CertPath certPath = certFactory.generateCertPath(certs);
      validator.validate(certPath, params);
    } catch (GeneralSecurityException e) {
      log.log(Level.WARNING, "Certificate validation failed, certs were: " + certs, e);
      throw new CertValidatorException("Certificate validation failure", e);
    }
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

    // estrae la catena logica dei certificati
    try
    {
      List certList = Arrays.asList(certificationChain);
      CertificateFactory certFactory = CertificateFactory.getInstance(X509_CERTIFICATE_TYPE);
      certPath = certFactory.generateCertPath(certList);

      List lista = certPath.getCertificates();
      // --- il certificato dell'utente e' sempre il primo della catena.
      if(lista.size() > 0)
        userCertificate = (X509Certificate) lista.get(0);
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

  {
    String certificato = "";
    List certList = Arrays.asList(certChain);
    CertificateFactory certFactory =
       CertificateFactory.getInstance(CryptoBaseEngine.X509_CERTIFICATE_TYPE);
    CertPath certPath = certFactory.generateCertPath(certList);
    List lista = certPath.getCertificates();
    for(int i = 0; i < lista.size(); i++)
    {
      certificato += SignUtils.createCERbase64((X509Certificate) lista.get(i));
    }
View Full Code Here

Examples of java.security.cert.CertificateFactory.generateCertPath()

     throws CertificateException
  {
    List certList = Arrays.asList(certChain);
    CertificateFactory certFactory =
       CertificateFactory.getInstance(CryptoBaseEngine.X509_CERTIFICATE_TYPE);
    CertPath certPath = certFactory.generateCertPath(certList);
    byte[] certPathEncoded = certPath.getEncoded(CryptoBaseEngine.CERTIFICATION_CHAIN_ENCODING);
    String base64encodedCertChain = new String(Base64.encodeBase64(certPathEncoded, true));
    return base64encodedCertChain;
  }
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.