@@ -0,0 +1,2826 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.tomcat.util.net;%0A%0Aimport java.util.Arrays;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Assume;%0Aimport org.junit.Test;%0A%0Aimport org.apache.catalina.startup.Tomcat;%0Aimport org.apache.catalina.startup.TomcatBaseTest;%0Aimport org.apache.tomcat.util.buf.ByteChunk;%0Aimport org.apache.tomcat.util.compat.TLS;%0A%0A/**%0A * The keys and certificates used in this file are all available in svn and were%0A * generated using a test CA the files for which are in the Tomcat PMC private%0A * repository since not all of them are AL2 licensed.%0A *%0A * The JSSE implementation of TLSv1.3 only supports authentication during the%0A * initial handshake.%0A */%0Apublic class TestClientCertTls13 extends TomcatBaseTest %7B%0A%0A    @Test%0A    public void testClientCertGet() throws Exception %7B%0A        Assume.assumeTrue(TLS.isTlsv13Available());%0A        getTomcatInstance().start();%0A        ByteChunk res = getUrl(%22https://localhost:%22 + getPort() + %22/protected%22);%0A        Assert.assertEquals(%22OK-%22 + TesterSupport.ROLE, res.toString());%0A    %7D%0A%0A    @Test%0A    public void testClientCertPost() throws Exception %7B%0A        getTomcatInstance().start();%0A%0A        int size = 32 * 1024;%0A%0A        byte%5B%5D body = new byte%5Bsize%5D;%0A        Arrays.fill(body, TesterSupport.DATA);%0A%0A        // Protected resource%0A        ByteChunk res = new ByteChunk();%0A        int rc = postUrl(body, %22https://localhost:%22 + getPort() + %22/protected%22, res, null);%0A%0A        Assert.assertEquals(200, rc);%0A        Assert.assertEquals(%22OK-%22 + size, res.toString());%0A    %7D%0A%0A    @Override%0A    public void setUp() throws Exception %7B%0A        super.setUp();%0A%0A        Tomcat tomcat = getTomcatInstance();%0A%0A        TesterSupport.configureClientCertContext(tomcat);%0A        // Need to override some of the previous settings%0A        tomcat.getConnector().setProperty(%22sslEnabledProtocols%22, %22TLSv1.3%22);%0A        // And add force authentication to occur on the initial handshake%0A        tomcat.getConnector().setProperty(%22clientAuth%22, %22required%22);%0A%0A        TesterSupport.configureClientSsl();%0A    %7D%0A%7D%0A

Add a test case for TLS 1.3 CLIENT-CERT