1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.core;
4 import javax.net.ssl.ManagerFactoryParameters;
5 import javax.net.ssl.TrustManager;
6 import javax.net.ssl.TrustManagerFactorySpi;
7 import javax.net.ssl.X509TrustManager;
8 import java.security.InvalidAlgorithmParameterException;
9 import java.security.KeyStore;
10 import java.security.KeyStoreException;
11 import java.security.cert.X509Certificate;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
17 * @author michal.polkorab
19 public class SslTrustManagerFactory extends TrustManagerFactorySpi {
22 * Logger for SslTrustManagerFactory
24 public static final Logger logger = LoggerFactory.getLogger(SslTrustManagerFactory.class);
25 private static final TrustManager DUMMY_TRUST_MANAGER = new X509TrustManager() {
27 public X509Certificate[] getAcceptedIssuers() {
28 return new X509Certificate[0];
32 public void checkClientTrusted(X509Certificate[] chain, String authType) {
33 logger.error("UNKNOWN CLIENT CERTIFICATE: " + chain[0].getSubjectDN());
37 public void checkServerTrusted(X509Certificate[] chain, String authType) {
38 logger.error("UNKNOWN SERVER CERTIFICATE: " + chain[0].getSubjectDN());
43 * Getter for TrustManagers
45 * @return TrustManager[]
47 public static TrustManager[] getTrustManagers() {
48 return new TrustManager[]{DUMMY_TRUST_MANAGER};
52 protected TrustManager[] engineGetTrustManagers() {
53 return getTrustManagers();
57 protected void engineInit(KeyStore ks) throws KeyStoreException {
58 throw new UnsupportedOperationException("Not supported yet.");
62 protected void engineInit(ManagerFactoryParameters mfp) throws InvalidAlgorithmParameterException {
63 throw new UnsupportedOperationException("Not supported yet.");