001/* 002 * $HeadURL: file:///opt/dev/not-yet-commons-ssl-SVN-repo/tags/commons-ssl-0.3.17/src/java/org/apache/commons/ssl/Java13KeyManagerWrapper.java $ 003 * $Revision: 121 $ 004 * $Date: 2007-11-13 21:26:57 -0800 (Tue, 13 Nov 2007) $ 005 * 006 * ==================================================================== 007 * Licensed to the Apache Software Foundation (ASF) under one 008 * or more contributor license agreements. See the NOTICE file 009 * distributed with this work for additional information 010 * regarding copyright ownership. The ASF licenses this file 011 * to you under the Apache License, Version 2.0 (the 012 * "License"); you may not use this file except in compliance 013 * with the License. You may obtain a copy of the License at 014 * 015 * http://www.apache.org/licenses/LICENSE-2.0 016 * 017 * Unless required by applicable law or agreed to in writing, 018 * software distributed under the License is distributed on an 019 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 020 * KIND, either express or implied. See the License for the 021 * specific language governing permissions and limitations 022 * under the License. 023 * ==================================================================== 024 * 025 * This software consists of voluntary contributions made by many 026 * individuals on behalf of the Apache Software Foundation. For more 027 * information on the Apache Software Foundation, please see 028 * <http://www.apache.org/>. 029 * 030 */ 031 032package org.apache.commons.ssl; 033 034import com.sun.net.ssl.X509KeyManager; 035 036import java.security.Principal; 037import java.security.PrivateKey; 038import java.security.cert.X509Certificate; 039 040/** 041 * @author Credit Union Central of British Columbia 042 * @author <a href="http://www.cucbc.com/">www.cucbc.com</a> 043 * @author <a href="mailto:juliusdavies@cucbc.com">juliusdavies@cucbc.com</a> 044 * @since 30-Jun-2006 045 */ 046public class Java13KeyManagerWrapper implements X509KeyManager { 047 048 private final X509KeyManager keyManager; 049 // private final KeyMaterial keyMaterial; <-- maybe use one day in the 050 // private final SSL ssl; <-- in the future? 051 052 public Java13KeyManagerWrapper(X509KeyManager m, KeyMaterial km, SSL h) { 053 this.keyManager = m; 054 // this.keyMaterial = km; <-- maybe use one day in the 055 // this.ssl = h; <-- in the future? 056 } 057 058 public String chooseClientAlias(String keyType, Principal[] issuers) { 059 return keyManager.chooseClientAlias(keyType, issuers); 060 } 061 062 public String chooseServerAlias(String keyType, Principal[] issuers) { 063 return keyManager.chooseServerAlias(keyType, issuers); 064 } 065 066 public X509Certificate[] getCertificateChain(String alias) { 067 return keyManager.getCertificateChain(alias); 068 } 069 070 public String[] getClientAliases(String keyType, Principal[] issuers) { 071 return keyManager.getClientAliases(keyType, issuers); 072 } 073 074 public PrivateKey getPrivateKey(String alias) { 075 return keyManager.getPrivateKey(alias); 076 } 077 078 public String[] getServerAliases(String keyType, Principal[] issuers) { 079 return keyManager.getServerAliases(keyType, issuers); 080 } 081 082}