2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowjava.protocol.impl.core;
11 import javax.net.ssl.ManagerFactoryParameters;
12 import javax.net.ssl.TrustManager;
13 import javax.net.ssl.TrustManagerFactorySpi;
14 import javax.net.ssl.X509TrustManager;
15 import java.security.InvalidAlgorithmParameterException;
16 import java.security.KeyStore;
17 import java.security.KeyStoreException;
18 import java.security.cert.X509Certificate;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
24 * @author michal.polkorab
26 public class SslTrustManagerFactory extends TrustManagerFactorySpi {
29 * Logger for SslTrustManagerFactory
31 public static final Logger LOGGER = LoggerFactory.getLogger(SslTrustManagerFactory.class);
32 private static final TrustManager DUMMY_TRUST_MANAGER = new X509TrustManager() {
34 public X509Certificate[] getAcceptedIssuers() {
35 return new X509Certificate[0];
39 public void checkClientTrusted(X509Certificate[] chain, String authType) {
40 LOGGER.error("UNKNOWN CLIENT CERTIFICATE: " + chain[0].getSubjectDN());
44 public void checkServerTrusted(X509Certificate[] chain, String authType) {
45 LOGGER.error("UNKNOWN SERVER CERTIFICATE: " + chain[0].getSubjectDN());
50 * Getter for TrustManagers
52 * @return TrustManager[]
54 public static TrustManager[] getTrustManagers() {
55 return new TrustManager[]{DUMMY_TRUST_MANAGER};
59 protected TrustManager[] engineGetTrustManagers() {
60 return getTrustManagers();
64 protected void engineInit(KeyStore ks) throws KeyStoreException {
65 throw new UnsupportedOperationException("Not supported yet.");
69 protected void engineInit(ManagerFactoryParameters mfp) throws InvalidAlgorithmParameterException {
70 throw new UnsupportedOperationException("Not supported yet.");