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

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

      
    
Rootfs path

      
    
Size
3535 (3.5 KB)
MD5
94e2c1b5dd2d2c75230ea82d8b242d4e
SHA1
1df86dcc5d56c5cc376ea03b55666f700cc00fc2
SHA256
064a8950de502a02d30af61a082ae33e291b3aee648cabd54cd6d00515d2f2e9
SHA512

      
    
SHA1_git
b326885b724dbe97db2b090d935374b09d4b00c5
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
JSSESSLContext.java | 3.5 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.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.cert.X509Certificate; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import javax.net.ssl.KeyManager; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.SSLSessionContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509KeyManager; import javax.net.ssl.X509TrustManager; import org.apache.tomcat.util.net.SSLContext; class JSSESSLContext implements SSLContext { private final javax.net.ssl.SSLContext context; private KeyManager[] kms; private TrustManager[] tms; JSSESSLContext(String protocol) throws NoSuchAlgorithmException { context = javax.net.ssl.SSLContext.getInstance(protocol); } @Override public void init(KeyManager[] kms, TrustManager[] tms, SecureRandom sr) throws KeyManagementException { this.kms = kms; this.tms = tms; context.init(kms, tms, sr); } @Override public void destroy() { } @Override public SSLSessionContext getServerSessionContext() { return context.getServerSessionContext(); } @Override public SSLEngine createSSLEngine() { return context.createSSLEngine(); } @Override public SSLServerSocketFactory getServerSocketFactory() { return context.getServerSocketFactory(); } @Override public SSLParameters getSupportedSSLParameters() { return context.getSupportedSSLParameters(); } @Override public X509Certificate[] getCertificateChain(String alias) { X509Certificate[] result = null; if (kms != null) { for (int i = 0; i < kms.length && result == null; i++) { if (kms[i] instanceof X509KeyManager) { result = ((X509KeyManager) kms[i]).getCertificateChain(alias); } } } return result; } @Override public X509Certificate[] getAcceptedIssuers() { Set<X509Certificate> certs = new HashSet<>(); if (tms != null) { for (TrustManager tm : tms) { if (tm instanceof X509TrustManager) { X509Certificate[] accepted = ((X509TrustManager) tm).getAcceptedIssuers(); certs.addAll(Arrays.asList(accepted)); } } } return certs.toArray(new X509Certificate[0]); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
33.43
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