You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2018/10/10 08:02:54 UTC
svn commit: r1843405 -
/tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCertTls13.java
Author: markt
Date: Wed Oct 10 08:02:54 2018
New Revision: 1843405
URL: http://svn.apache.org/viewvc?rev=1843405&view=rev
Log:
Add a test case for TLS 1.3 CLIENT-CERT
Added:
tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCertTls13.java (with props)
Added: tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCertTls13.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCertTls13.java?rev=1843405&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCertTls13.java (added)
+++ tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCertTls13.java Wed Oct 10 08:02:54 2018
@@ -0,0 +1,79 @@
+/*
+ * 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;
+
+import java.util.Arrays;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Test;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.tomcat.util.buf.ByteChunk;
+import org.apache.tomcat.util.compat.TLS;
+
+/**
+ * The keys and certificates used in this file are all available in svn and were
+ * generated using a test CA the files for which are in the Tomcat PMC private
+ * repository since not all of them are AL2 licensed.
+ *
+ * The JSSE implementation of TLSv1.3 only supports authentication during the
+ * initial handshake.
+ */
+public class TestClientCertTls13 extends TomcatBaseTest {
+
+ @Test
+ public void testClientCertGet() throws Exception {
+ Assume.assumeTrue(TLS.isTlsv13Available());
+ getTomcatInstance().start();
+ ByteChunk res = getUrl("https://localhost:" + getPort() + "/protected");
+ Assert.assertEquals("OK-" + TesterSupport.ROLE, res.toString());
+ }
+
+ @Test
+ public void testClientCertPost() throws Exception {
+ getTomcatInstance().start();
+
+ int size = 32 * 1024;
+
+ byte[] body = new byte[size];
+ Arrays.fill(body, TesterSupport.DATA);
+
+ // Protected resource
+ ByteChunk res = new ByteChunk();
+ int rc = postUrl(body, "https://localhost:" + getPort() + "/protected", res, null);
+
+ Assert.assertEquals(200, rc);
+ Assert.assertEquals("OK-" + size, res.toString());
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ Tomcat tomcat = getTomcatInstance();
+
+ TesterSupport.configureClientCertContext(tomcat);
+ // Need to override some of the previous settings
+ tomcat.getConnector().setProperty("sslEnabledProtocols", "TLSv1.3");
+ // And add force authentication to occur on the initial handshake
+ tomcat.getConnector().setProperty("clientAuth", "required");
+
+ TesterSupport.configureClientSsl();
+ }
+}
Propchange: tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCertTls13.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org