Source Code Cross Referenced for JSSEKeyManager.java in  » Sevlet-Container » tomcat-connectors » org » apache » tomcat » util » net » jsse » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » tomcat connectors » org.apache.tomcat.util.net.jsse 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Copyright 1999-2004 The Apache Software Foundation
003:         *
004:         *  Licensed under the Apache License, Version 2.0 (the "License");
005:         *  you may not use this file except in compliance with the License.
006:         *  You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         *  Unless required by applicable law or agreed to in writing, software
011:         *  distributed under the License is distributed on an "AS IS" BASIS,
012:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         *  See the License for the specific language governing permissions and
014:         *  limitations under the License.
015:         */
016:
017:        package org.apache.tomcat.util.net.jsse;
018:
019:        import java.net.Socket;
020:        import java.security.Principal;
021:        import java.security.PrivateKey;
022:        import java.security.cert.X509Certificate;
023:        import javax.net.ssl.X509KeyManager;
024:
025:        /**
026:         * X509KeyManager which allows selection of a specific keypair and certificate
027:         * chain (identified by their keystore alias name) to be used by the server to
028:         * authenticate itself to SSL clients.
029:         *
030:         * @author Jan Luehe
031:         */
032:        public final class JSSEKeyManager implements  X509KeyManager {
033:
034:            private X509KeyManager delegate;
035:            private String serverKeyAlias;
036:
037:            /**
038:             * Constructor.
039:             *
040:             * @param mgr The X509KeyManager used as a delegate
041:             * @param serverKeyAlias The alias name of the server's keypair and
042:             * supporting certificate chain
043:             */
044:            public JSSEKeyManager(X509KeyManager mgr, String serverKeyAlias) {
045:                this .delegate = mgr;
046:                this .serverKeyAlias = serverKeyAlias;
047:            }
048:
049:            /**
050:             * Choose an alias to authenticate the client side of a secure socket,
051:             * given the public key type and the list of certificate issuer authorities
052:             * recognized by the peer (if any).
053:             *
054:             * @param keyType The key algorithm type name(s), ordered with the
055:             * most-preferred key type first
056:             * @param issuers The list of acceptable CA issuer subject names, or null
057:             * if it does not matter which issuers are used
058:             * @param socket The socket to be used for this connection. This parameter
059:             * can be null, in which case this method will return the most generic
060:             * alias to use
061:             *
062:             * @return The alias name for the desired key, or null if there are no
063:             * matches
064:             */
065:            public String chooseClientAlias(String[] keyType,
066:                    Principal[] issuers, Socket socket) {
067:                return delegate.chooseClientAlias(keyType, issuers, socket);
068:            }
069:
070:            /**
071:             * Returns this key manager's server key alias that was provided in the
072:             * constructor.
073:             *
074:             * @param keyType The key algorithm type name (ignored)
075:             * @param issuers The list of acceptable CA issuer subject names, or null
076:             * if it does not matter which issuers are used (ignored)
077:             * @param socket The socket to be used for this connection. This parameter
078:             * can be null, in which case this method will return the most generic
079:             * alias to use (ignored)
080:             *
081:             * @return Alias name for the desired key
082:             */
083:            public String chooseServerAlias(String keyType,
084:                    Principal[] issuers, Socket socket) {
085:                return serverKeyAlias;
086:            }
087:
088:            /**
089:             * Returns the certificate chain associated with the given alias.
090:             *
091:             * @param alias The alias name
092:             *
093:             * @return Certificate chain (ordered with the user's certificate first
094:             * and the root certificate authority last), or null if the alias can't be
095:             * found
096:             */
097:            public X509Certificate[] getCertificateChain(String alias) {
098:                return delegate.getCertificateChain(alias);
099:            }
100:
101:            /**
102:             * Get the matching aliases for authenticating the client side of a secure
103:             * socket, given the public key type and the list of certificate issuer
104:             * authorities recognized by the peer (if any).
105:             *
106:             * @param keyType The key algorithm type name
107:             * @param issuers The list of acceptable CA issuer subject names, or null
108:             * if it does not matter which issuers are used
109:             *
110:             * @return Array of the matching alias names, or null if there were no
111:             * matches
112:             */
113:            public String[] getClientAliases(String keyType, Principal[] issuers) {
114:                return delegate.getClientAliases(keyType, issuers);
115:            }
116:
117:            /**
118:             * Get the matching aliases for authenticating the server side of a secure
119:             * socket, given the public key type and the list of certificate issuer
120:             * authorities recognized by the peer (if any).
121:             *
122:             * @param keyType The key algorithm type name
123:             * @param issuers The list of acceptable CA issuer subject names, or null
124:             * if it does not matter which issuers are used
125:             *
126:             * @return Array of the matching alias names, or null if there were no
127:             * matches
128:             */
129:            public String[] getServerAliases(String keyType, Principal[] issuers) {
130:                return delegate.getServerAliases(keyType, issuers);
131:            }
132:
133:            /**
134:             * Returns the key associated with the given alias.
135:             *
136:             * @param alias The alias name
137:             *
138:             * @return The requested key, or null if the alias can't be found
139:             */
140:            public PrivateKey getPrivateKey(String alias) {
141:                return delegate.getPrivateKey(alias);
142:            }
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.