blob: 27dd7c62b5dbe97e22bde2d612828f3bfa397f7f [file] [log] [blame]
Jerome Poichet7c997852014-05-20 10:50:05 -07001/*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.polo.ssl;
18
19import java.security.KeyManagementException;
20import java.security.NoSuchAlgorithmException;
21
22import javax.net.ssl.KeyManager;
23import javax.net.ssl.SSLServerSocketFactory;
24import javax.net.ssl.TrustManager;
25
26
27/**
28 * An {@link SSLServerSocketFactory} that performs no verification on client
29 * certificates; ie, is all-trusting.
30 *
31 * @see DummyTrustManager
32 */
33public class DummySSLServerSocketFactory extends SSLServerSocketFactoryWrapper {
34
35 DummySSLServerSocketFactory(KeyManager[] keyManagers,
36 TrustManager[] trustManagers) throws KeyManagementException,
37 NoSuchAlgorithmException {
38 super(keyManagers, trustManagers);
39 }
40
41 public static DummySSLServerSocketFactory fromKeyManagers(
42 KeyManager[] keyManagers) throws KeyManagementException,
43 NoSuchAlgorithmException {
44 TrustManager[] trustManagers = { new DummyTrustManager() };
45 return new DummySSLServerSocketFactory(keyManagers, trustManagers);
46 }
47
48}