ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/util/net/jsse/JSSEKeyManager.java
Status
scanned
Type
file
Name
JSSEKeyManager.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
3928 (3.8 KB)
MD5
d9f51ebc021e5f861d5e803fe6df9715
SHA1
153e45e8e4fdf95cf83de8b4a673f28e9da7ff90
SHA256
ec21183e24de2de4d98307c29658e73b0d79cce6b93949272141f6e7f6473b4b
SHA512

      
    
SHA1_git
8e9f95d559a0f1d0f66147555127ab59a0ed8ccd
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
JSSEKeyManager.java | 3.8 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.tomcat.util.net.jsse; import java.net.Socket; import java.security.Principal; import java.security.PrivateKey; import java.security.cert.X509Certificate; import javax.net.ssl.SSLEngine; import javax.net.ssl.X509ExtendedKeyManager; import javax.net.ssl.X509KeyManager; /** * X509KeyManager which allows selection of a specific key pair and certificate chain (identified by their keystore * alias name) to be used by the server to authenticate itself to SSL clients. */ public final class JSSEKeyManager extends X509ExtendedKeyManager { private final X509KeyManager delegate; private final String serverKeyAlias; /** * Constructor. * * @param mgr The X509KeyManager used as a delegate * @param serverKeyAlias The alias name of the server's key pair and supporting certificate chain */ public JSSEKeyManager(X509KeyManager mgr, String serverKeyAlias) { super(); this.delegate = mgr; this.serverKeyAlias = serverKeyAlias; } /** * Returns the server key alias that was provided in the constructor or the result from * {@link X509KeyManager#chooseServerAlias(String, Principal[], Socket)} for the delegate if no alias is specified. */ @Override public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) { if (serverKeyAlias != null) { return serverKeyAlias; } return delegate.chooseServerAlias(keyType, issuers, socket); } /** * Returns the server key alias that was provided in the constructor or the result from * {@link X509ExtendedKeyManager#chooseEngineServerAlias(String, Principal[], SSLEngine)} for the delegate if no * alias is specified. */ @Override public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) { if (serverKeyAlias != null) { return serverKeyAlias; } return super.chooseEngineServerAlias(keyType, issuers, engine); } @Override public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket socket) { return delegate.chooseClientAlias(keyType, issuers, socket); } @Override public X509Certificate[] getCertificateChain(String alias) { return delegate.getCertificateChain(alias); } @Override public String[] getClientAliases(String keyType, Principal[] issuers) { return delegate.getClientAliases(keyType, issuers); } @Override public String[] getServerAliases(String keyType, Principal[] issuers) { return delegate.getServerAliases(keyType, issuers); } @Override public PrivateKey getPrivateKey(String alias) { return delegate.getPrivateKey(alias); } @Override public String chooseEngineClientAlias(String[] keyType, Principal[] issuers, SSLEngine engine) { return delegate.chooseClientAlias(keyType, issuers, null); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
28.74
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9