private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
/** * Creates a new {@code X509Certificate} and initializes it from the * specified byte array. * * @param certData * byte array containing data to initialize the certificate. * @return the certificate initialized from the specified byte array * @throws CertificateException * if the certificate cannot be created or initialized. */ public static final X509Certificate getInstance(byte[] certData) throws CertificateException { if (certData == null) { throw new CertificateException("certData == null"); } ByteArrayInputStream bais = new ByteArrayInputStream(certData); return getInstance(bais); }
/** * * @param sessionId The SSL session ID * @param cypherSuite The cypher suite name * @param certificate A string representation of the client certificate * @throws java.security.cert.CertificateException If the client cert could not be decoded * @throws CertificateException If the client cert could not be decoded */ public BasicSSLSessionInfo(byte[] sessionId, String cypherSuite, String certificate) throws java.security.cert.CertificateException, CertificateException { this.sessionId = sessionId; this.cypherSuite = cypherSuite; if (certificate != null) { java.security.cert.CertificateFactory cf = java.security.cert.CertificateFactory.getInstance("X.509"); byte[] certificateBytes = certificate.getBytes(StandardCharsets.US_ASCII); ByteArrayInputStream stream = new ByteArrayInputStream(certificateBytes); Collection<? extends java.security.cert.Certificate> certCol = cf.generateCertificates(stream); this.peerCertificate = new java.security.cert.Certificate[certCol.size()]; this.certificate = new X509Certificate[certCol.size()]; int i=0; for(java.security.cert.Certificate cert : certCol) { this.peerCertificate[i] = cert; this.certificate[i++] = X509Certificate.getInstance(cert.getEncoded()); } } else { this.peerCertificate = null; this.certificate = null; } } /**
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
/** * Returns a certificate constructed from the given DER bytes. */ public static Certificate certificateFrom(final byte[] derBytes) throws InvalidKeySpecException { try { return X509Certificate.getInstance(derBytes); } catch (CertificateException e) { throw new IllegalStateException(e); } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
private X509Certificate unwrap() { X509Certificate wrapped = this.wrapped; if (wrapped == null) { try { wrapped = this.wrapped = X509Certificate.getInstance(bytes); } catch (CertificateException e) { throw new IllegalStateException(e); } } return wrapped; } }
/** * Converts a java.security.cert.X509Certificate to javax.security.cert.X509Certificate */ public static javax.security.cert.X509Certificate convert(final X509Certificate cert) { if (cert == null) return null; try { return javax.security.cert.X509Certificate.getInstance(cert.getEncoded()); } catch (final Exception ex) { throw new IllegalArgumentException("[cert] " + cert + " is not convertable!", ex); } }
public CertInfo(String certPath) { try { FileInputStream file = new FileInputStream(certPath); X509Certificate cert = X509Certificate.getInstance(file); this.certs = new X509Certificate[]{cert}; } catch(FileNotFoundException|CertificateException e) { logger.error(e.getMessage(), e); } }