use of javax.net.ssl.X509ExtendedTrustManager in project smarthome by eclipse.
the class ExtensibleTrustManagerImpl method checkClientTrusted.
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType, SSLEngine sslEngine) throws CertificateException {
X509ExtendedTrustManager linkedTrustManager = getLinkedTrustMananger(chain, sslEngine);
if (linkedTrustManager == null) {
logger.trace("No specific trust manager found, falling back to default");
defaultTrustManager.checkClientTrusted(chain, authType, sslEngine);
} else {
linkedTrustManager.checkClientTrusted(chain, authType, sslEngine);
}
}
use of javax.net.ssl.X509ExtendedTrustManager in project smarthome by eclipse.
the class ExtensibleTrustManagerImpl method checkServerTrusted.
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException {
X509ExtendedTrustManager linkedTrustManager = getLinkedTrustMananger(chain);
if (linkedTrustManager == null) {
logger.trace("No specific trust manager found, falling back to default");
defaultTrustManager.checkServerTrusted(chain, authType, socket);
} else {
linkedTrustManager.checkServerTrusted(chain, authType, socket);
}
}
use of javax.net.ssl.X509ExtendedTrustManager in project smarthome by eclipse.
the class ExtensibleTrustManagerImpl method getLinkedTrustMananger.
private X509ExtendedTrustManager getLinkedTrustMananger(X509Certificate[] chain) {
try {
String commonName = getCommonName(chain[0]);
X509ExtendedTrustManager trustManager = linkedTrustManager.getOrDefault(commonName, EMPTY_QUEUE).peek();
if (trustManager != null) {
logger.trace("Found trustManager by common name: {}", commonName);
return trustManager;
}
Collection<List<?>> subjectAlternatives = getSubjectAlternatives(chain);
logger.trace("Searching trustManager by Subject Alternative Names: {}", subjectAlternatives);
// @formatter:off
return subjectAlternatives.stream().map(e -> e.get(1)).map(Object::toString).map(linkedTrustManager::get).filter(Objects::nonNull).map(Queue::peek).filter(Objects::nonNull).findFirst().orElse(null);
// @formatter:on
} catch (CommonNameNotFoundException e) {
logger.debug("CN not found", e.getMessage());
return null;
} catch (CertificateParsingException e) {
logger.debug("Problem while parsing certificate", e);
return null;
}
}
use of javax.net.ssl.X509ExtendedTrustManager in project smarthome by eclipse.
the class ExtensibleTrustManagerImpl method checkServerTrusted.
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine sslEngine) throws CertificateException {
X509ExtendedTrustManager linkedTrustManager = getLinkedTrustMananger(chain, sslEngine);
if (linkedTrustManager == null) {
logger.trace("No specific trust manager found, falling back to default");
defaultTrustManager.checkServerTrusted(chain, authType, sslEngine);
} else {
linkedTrustManager.checkServerTrusted(chain, authType, sslEngine);
}
}
use of javax.net.ssl.X509ExtendedTrustManager in project smarthome by eclipse.
the class ExtensibleTrustManagerImpl method checkClientTrusted.
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType, Socket socket) throws CertificateException {
X509ExtendedTrustManager linkedTrustManager = getLinkedTrustMananger(chain);
if (linkedTrustManager == null) {
logger.trace("No specific trust manager found, falling back to default");
defaultTrustManager.checkClientTrusted(chain, authType, socket);
} else {
linkedTrustManager.checkClientTrusted(chain, authType, socket);
}
}
Aggregations