本文整理了Java中javax.security.cert.X509Certificate.getInstance()
方法的一些代码示例,展示了X509Certificate.getInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X509Certificate.getInstance()
方法的具体详情如下:
包路径:javax.security.cert.X509Certificate
类名称:X509Certificate
方法名:getInstance
[英]Creates a new X509Certificate and initializes it from the specified input stream.
[中]创建新的X509证书,并从指定的输入流对其进行初始化。
代码示例来源:origin: redisson/redisson
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;
}
}
代码示例来源:origin: wildfly/wildfly
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;
}
}
代码示例来源:origin: robovm/robovm
/**
* 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);
}
代码示例来源:origin: wildfly/wildfly
/**
*
* @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;
}
}
/**
代码示例来源:origin: io.netty/netty-handler
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;
}
}
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
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;
}
}
代码示例来源:origin: apache/activemq-artemis
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;
}
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
/**
* 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);
}
}
代码示例来源:origin: apache/activemq-artemis
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;
}
}
代码示例来源:origin: com.datastax.oss/java-driver-core-shaded
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;
}
}
代码示例来源:origin: com.aliyun.openservices/ons-client
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;
}
}
代码示例来源:origin: org.apache.ratis/ratis-proto-shaded
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;
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
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;
}
}
代码示例来源:origin: org.apache.hbase.thirdparty/hbase-shaded-netty
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;
}
}
代码示例来源:origin: com.couchbase.client/core-io
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;
}
}
代码示例来源:origin: couchbase/couchbase-jvm-core
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;
}
}
代码示例来源:origin: io.bitsensor/proto
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;
}
}
代码示例来源:origin: KostyaSha/yet-another-docker-plugin
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;
}
}
代码示例来源:origin: net.sf.jstuff/jstuff-core
/**
* 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);
}
}
代码示例来源:origin: GruppoFilippetti/vertx-mqtt-broker
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);
}
}
内容来源于网络,如有侵权,请联系作者删除!