001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019 020 021 package org.apache.geronimo.jetty6.connector; 022 023 import java.security.KeyStoreException; 024 import java.security.NoSuchAlgorithmException; 025 import java.security.UnrecoverableKeyException; 026 import java.security.NoSuchProviderException; 027 import java.security.KeyManagementException; 028 import java.security.cert.CertificateException; 029 import java.io.IOException; 030 031 import javax.net.ssl.SSLServerSocketFactory; 032 import javax.net.ssl.SSLContext; 033 034 import org.mortbay.jetty.security.SslSocketConnector; 035 import org.mortbay.jetty.security.SslSelectChannelConnector; 036 import org.apache.geronimo.management.geronimo.KeystoreManager; 037 038 /** 039 * SSL listener that hooks into the Geronimo keystore infrastructure. 040 * 041 * @version $Rev: 543715 $ $Date: 2007-06-02 04:10:16 -0400 (Sat, 02 Jun 2007) $ 042 */ 043 public class GeronimoSelectChannelSSLListener extends SslSelectChannelConnector { 044 private KeystoreManager manager; 045 private String keyStore; 046 private String trustStore; 047 private String keyAlias; 048 049 public GeronimoSelectChannelSSLListener(KeystoreManager manager) { 050 this.manager = manager; 051 } 052 053 protected SSLContext createSSLContext() throws Exception { 054 return manager.createSSLContext(null, getProtocol(), getSslKeyManagerFactoryAlgorithm(), keyStore, keyAlias, trustStore, SslSocketConnector.class.getClassLoader()); 055 } 056 057 public String getKeyStore() { 058 return keyStore; 059 } 060 061 public void setKeyStore(String keyStore) { 062 this.keyStore = keyStore; 063 } 064 065 public String getTrustStore() { 066 return trustStore; 067 } 068 069 public void setTrustStore(String trustStore) { 070 this.trustStore = trustStore; 071 } 072 073 public String getKeyAlias() { 074 return keyAlias; 075 } 076 077 public void setKeyAlias(String keyAlias) { 078 this.keyAlias = keyAlias; 079 } 080 }