public static SSLSocketFactory getSocketFactory(X509CertificateChain chain) { KeyStore ts = null; KeyStore ks = null; if (chain != null) ks = getKeyStore(chain.getChain(), chain.getPrivateKey()); return getSocketFactory(ks, ts); }
/** * Create a subject with the specified certificate chain and private key. * This method constructs an X509CertificateChain and then calls * getSubject(X509CertificateChain). * * @param certs a non-null and non-empty certificate chain * @param key optional private key * @return a Subject */ public static Subject getSubject(X509Certificate[] certs, PrivateKey key) { final X509CertificateChain chain = new X509CertificateChain(certs, key); return getSubject(chain); }
public X509CertificateChain(X509Certificate[] chain, PrivateKey key) { if (chain == null || chain.length == 0) throw new IllegalArgumentException("cannot create X509CertificateChain with no certficates"); this.chain = chain; genExpiryDate(); this.key = key; initPrincipal(); this.hashKey = genHashKey(principal); }
Date end = null; Principal principal = null; for (X509Certificate c : chain.getChain())
chain = new X509CertificateChain(Arrays.asList(ca)); if (chain != null) { principals.add(chain.getPrincipal());
X509CertificateChain privateKeyChain = X509CertificateChain.findPrivateKeyChain( subject.getPublicCredentials()); privateKeyChain.getChain()[0].checkValidity(); privateKeyChain.getChain()[0].checkValidity();
public static X509CertificateChain findPrivateKeyChain(Set<Object> publicCredentials) { for (Object credential : publicCredentials) { if (credential instanceof X509CertificateChain) { X509CertificateChain chain = (X509CertificateChain) credential; if (chain.getPrivateKey() != null) { return chain; } } } return null; }
public X509CertificateChain(X500Principal principal, PrivateKey privateKey, String csrString) { this.principal = principal; this.csrString = csrString; this.key = privateKey; this.hashKey = genHashKey(principal); this.chain = null; this.endEntity = null; }
public void setChain(X509Certificate[] chain) { this.chain = chain; genExpiryDate(); }
private X509Certificate[] createProxyCertChain(X509Certificate cert) { AccessControlContext ac = AccessController.getContext(); Subject subject = Subject.getSubject(ac); if (subject != null) { Set<X509CertificateChain> cc = subject.getPublicCredentials(X509CertificateChain.class); if (cc.size() > 0) { X509CertificateChain xcc = cc.iterator().next(); X509Certificate[] chain = xcc.getChain(); X509Certificate[] ret = new X509Certificate[chain.length + 1]; ret[0] = cert; for (int i=0; i<chain.length; i++) { ret[i+1] = chain[i]; } return ret; } } throw new IllegalStateException("current Subject does not contain a certficate chain"); }
"org.restlet.https.clientCertificates"); if ((requestCertificates != null) && (!requestCertificates.isEmpty())) { this.chain = new X509CertificateChain(requestCertificates); principals.add(this.chain.getPrincipal());
/** * @param chain certificate * @param writer writer use to write the generated PEM certificate * @throws IOException */ public static void writePEMCertificateAndKey( X509CertificateChain chain, Writer writer) throws IOException { if (chain == null) throw new IllegalArgumentException("Null certificate chain"); if (writer == null) throw new IllegalArgumentException("Null writer"); PEMWriter pemWriter = new PEMWriter(writer); // write the first certificate first pemWriter.writeObject(chain.getChain()[0]); // then the key pemWriter.writeObject(chain.getPrivateKey()); // and finally the rest of the certificates in the chain for (int i = 1; i < chain.getChain().length; i++) { pemWriter.writeObject(chain.getChain()[i]); } pemWriter.flush(); } }
for (X509Certificate c : chain.getChain())
public X509CertificateChain(Collection<X509Certificate> certs) { if (certs == null || certs.isEmpty()) throw new IllegalArgumentException("cannot create X509CertificateChain with no certficates"); this.chain = certs.toArray(new X509Certificate[certs.size()]); genExpiryDate(); initPrincipal(); this.hashKey = genHashKey(principal); }
X509Certificate[] chain = readCertificateChain(certificates); return new X509CertificateChain(chain, pk);
CertificateNotYetValidException X509Certificate issuerCert = chain.getChain()[0]; PrivateKey issuerKey = chain.getPrivateKey(); for (X509Certificate currentCert : chain.getChain()) for (X509Certificate currentCert : chain.getChain()) for (X509Certificate currentCert : chain.getChain())
Date start = null; Date end = null; for (X509Certificate c : chain.getChain())
for (X509Certificate c : chain.getChain())