use of javax.security.cert.CertificateEncodingException in project robovm by robovm.
the class X509CertificateTest method testGetInstance1.
/**
* getInstance(InputStream inStream) method testing.
*/
public void testGetInstance1() {
if (this.cert == null) {
// Test can not be applied.
return;
}
try {
ByteArrayInputStream bais = new ByteArrayInputStream(cert.getEncoded());
X509Certificate.getInstance(bais);
} catch (java.security.cert.CertificateEncodingException e) {
fail("Unexpected CertificateEncodingException was thrown.");
} catch (CertificateEncodingException e) {
fail("Unexpected CertificateEncodingException was thrown.");
} catch (CertificateException e) {
// The requested certificate type is not available.
// Test pass..
}
// Regression for HARMONY-756
try {
X509Certificate.getInstance((InputStream) null);
fail("No expected CertificateException");
} catch (CertificateException e) {
// expected;
}
}
use of javax.security.cert.CertificateEncodingException in project robovm by robovm.
the class CertificateEncodingExceptionTest method testCertificateEncodingException03.
/**
* Test for <code>CertificateEncodingException(String)</code> constructor
* Assertion: constructs CertificateEncodingException when <code>msg</code>
* is null
*/
public void testCertificateEncodingException03() {
String msg = null;
CertificateEncodingException tE = new CertificateEncodingException(msg);
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
use of javax.security.cert.CertificateEncodingException in project robovm by robovm.
the class CertificateEncodingExceptionTest method testCertificateEncodingException01.
/**
* Test for <code>CertificateEncodingException()</code> constructor
* Assertion: constructs CertificateEncodingException with no detail message
*/
public void testCertificateEncodingException01() {
CertificateEncodingException tE = new CertificateEncodingException();
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
use of javax.security.cert.CertificateEncodingException in project undertow by undertow-io.
the class SslClientCertAttribute method readAttribute.
@Override
public String readAttribute(HttpServerExchange exchange) {
SSLSessionInfo ssl = exchange.getConnection().getSslSessionInfo();
if (ssl == null) {
return null;
}
X509Certificate[] certificates;
try {
certificates = ssl.getPeerCertificateChain();
if (certificates.length > 0) {
return Certificates.toPem(certificates[0]);
}
return null;
} catch (SSLPeerUnverifiedException e) {
return null;
} catch (CertificateEncodingException e) {
return null;
} catch (RenegotiationRequiredException e) {
return null;
}
}
Aggregations