1/* 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.cert.X509Certificate; 20 21import javax.net.ssl.X509TrustManager; 22 23/** 24 * A trust manager that accepts all X509 client and server certificates. 25 * 26 * @see "http://java.sun.com/products/javamail/SSLNOTES.txt" 27 */ 28public class DummyTrustManager implements X509TrustManager { 29 30 public void checkClientTrusted(X509Certificate[] chain, String authType) { 31 // Does not throw CertificateException: all chains trusted 32 return; 33 } 34 35 public void checkServerTrusted(X509Certificate[] chain, String authType) { 36 // Does not throw CertificateException: all chains trusted 37 return; 38 } 39 40 public X509Certificate[] getAcceptedIssuers() { 41 return new X509Certificate[0]; 42 } 43 44} 45