Author: rjung Date: Sat Aug 19 20:50:13 2017 New Revision: 1805527 URL: http://svn.apache.org/viewvc?rev=1805527&view=rev Log: Add access to tcnative SSL_CONF API and some constants used by it.
Using the new API needs tcnative 1.2.13 though. Added: tomcat/trunk/java/org/apache/tomcat/jni/SSLConf.java (with props) Modified: tomcat/trunk/java/org/apache/tomcat/jni/SSL.java Modified: tomcat/trunk/java/org/apache/tomcat/jni/SSL.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/SSL.java?rev=1805527&r1=1805526&r2=1805527&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/jni/SSL.java (original) +++ tomcat/trunk/java/org/apache/tomcat/jni/SSL.java Sat Aug 19 20:50:13 2017 @@ -172,6 +172,18 @@ public final class SSL { public static final int SSL_MODE_SERVER = 1; public static final int SSL_MODE_COMBINED = 2; + public static final int SSL_CONF_FLAG_CMDLINE = 0x0001; + public static final int SSL_CONF_FLAG_FILE = 0x0002; + public static final int SSL_CONF_FLAG_CLIENT = 0x0004; + public static final int SSL_CONF_FLAG_SERVER = 0x0008; + public static final int SSL_CONF_FLAG_SHOW_ERRORS = 0x0010; + public static final int SSL_CONF_FLAG_CERTIFICATE = 0x0020; + + public static final int SSL_CONF_TYPE_UNKNOWN = 0x0000; + public static final int SSL_CONF_TYPE_STRING = 0x0001; + public static final int SSL_CONF_TYPE_FILE = 0x0002; + public static final int SSL_CONF_TYPE_DIR = 0x0003; + public static final int SSL_SHUTDOWN_TYPE_UNSET = 0; public static final int SSL_SHUTDOWN_TYPE_STANDARD = 1; public static final int SSL_SHUTDOWN_TYPE_UNCLEAN = 2; Added: tomcat/trunk/java/org/apache/tomcat/jni/SSLConf.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/SSLConf.java?rev=1805527&view=auto ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/jni/SSLConf.java (added) +++ tomcat/trunk/java/org/apache/tomcat/jni/SSLConf.java Sat Aug 19 20:50:13 2017 @@ -0,0 +1,113 @@ +/* + * 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.jni; + +/** SSL Conf + */ +public final class SSLConf { + + /** + * Create a new SSL_CONF context. + * + * @param pool The pool to use. + * @param flags The SSL_CONF flags to use. It can be any combination of + * the following: + * <PRE> + * {@link SSL#SSL_CONF_FLAG_CMDLINE} + * {@link SSL#SSL_CONF_FLAG_FILE} + * {@link SSL#SSL_CONF_FLAG_CLIENT} + * {@link SSL#SSL_CONF_FLAG_SERVER} + * {@link SSL#SSL_CONF_FLAG_SHOW_ERRORS} + * {@link SSL#SSL_CONF_FLAG_CERTIFICATE} + * </PRE> + * + * @return The Java representation of a pointer to the newly created + * SSL_CONF Context + * + * @throws Exception If the SSL_CONF context could not be created + * + * @see <a href="https://www.openssl.org/docs/man1.0.2/ssl/SSL_CONF_CTX_new.html">OpenSSL SSL_CONF_CTX_new</a> + * @see <a href="https://www.openssl.org/docs/man1.0.2/ssl/SSL_CONF_CTX_set_flags.html">OpenSSL SSL_CONF_CTX_set_flags</a> + */ + public static native long make(long pool, int flags) throws Exception; + + /** + * Free the resources used by the context + * + * @param cctx SSL_CONF context to free. + * + * @see <a href="https://www.openssl.org/docs/man1.0.2/ssl/SSL_CONF_CTX_new.html">OpenSSL SSL_CONF_CTX_free</a> + */ + public static native void free(long cctx); + + /** + * Check a command with an SSL_CONF context. + * + * @param cctx SSL_CONF context to use. + * @param name command name. + * @param value command value. + * + * @return The result of the check based on the {@code SSL_CONF_cmd_value_type} + * call. Unknown types will result in an exception, as well as + * file and directory types with invalid file or directory names. + * + * @throws Exception If the check fails. + * + * @see <a href="https://www.openssl.org/docs/man1.0.2/ssl/SSL_CONF_cmd.html">OpenSSL SSL_CONF_cmd_value_type</a> + */ + public static native int check(long cctx, String name, String value) throws Exception; + + /** + * Assign an SSL context to a SSL_CONF context. + * All following calls to {@link #apply(long, String, String)} will be + * applied to this SSL context. + * + * @param cctx SSL_CONF context to use. + * @param ctx SSL context to assign to the given SSL_CONF context. + * + * @see <a href="https://www.openssl.org/docs/man1.0.2/ssl/SSL_CONF_CTX_set_ssl_ctx.html">OpenSSL SSL_CONF_CTX_set_ssl_ctx</a> + */ + public static native void assign(long cctx, long ctx); + + /** + * Apply a command to an SSL_CONF context. + * + * @param cctx SSL_CONF context to use. + * @param name command name. + * @param value command value. + * + * @return The result of the native {@code SSL_CONF_cmd} call + * + * @throws Exception If the SSL_CONF context is {@code 0} + * + * @see <a href="https://www.openssl.org/docs/man1.0.2/ssl/SSL_CONF_cmd.html">OpenSSL SSL_CONF_cmd</a> + */ + public static native int apply(long cctx, String name, String value) throws Exception; + + /** + * Finish commands for an SSL_CONF context. + * + * @param cctx SSL_CONF context to use. + * + * @return The result of the native {@code SSL_CONF_CTX_finish} call + * + * @see <a href="https://www.openssl.org/docs/man1.0.2/ssl/SSL_CONF_CTX_set_flags.html">OpenSSL SSL_CONF_CTX_finish</a> + */ + public static native int finish(long cctx); + +} Propchange: tomcat/trunk/java/org/apache/tomcat/jni/SSLConf.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: tomcat/trunk/java/org/apache/tomcat/jni/SSLConf.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org