/* * 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;
/* Use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options * are 'ored' with SSL_VERIFY_PEER if they are desired
*/ publicstaticfinalint SSL_VERIFY_NONE = 0; publicstaticfinalint SSL_VERIFY_PEER = 1; publicstaticfinalint SSL_VERIFY_FAIL_IF_NO_PEER_CERT = 2; publicstaticfinalint SSL_VERIFY_CLIENT_ONCE = 4; publicstaticfinalint SSL_VERIFY_PEER_STRICT = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
/* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added * in OpenSSL 0.9.6d. Usually (depending on the application protocol) * the workaround is not needed. Unfortunately some broken SSL/TLS * implementations cannot handle it at all, which is why we include
* it in SSL_OP_ALL. */ publicstaticfinalint SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS = 0x00000800;
/* SSL_OP_ALL: various bug workarounds that should be rather harmless.
* This used to be 0x000FFFFFL before 0.9.7. */ publicstaticfinalint SSL_OP_ALL = 0x00000FFF; /* As server, disallow session resumption on renegotiation */ publicstaticfinalint SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = 0x00010000; /* Don't use compression even if supported */ publicstaticfinalint SSL_OP_NO_COMPRESSION = 0x00020000; /* Permit unsafe legacy renegotiation */ publicstaticfinalint SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION = 0x00040000; /* If set, always create a new key when using tmp_eddh parameters */ publicstaticfinalint SSL_OP_SINGLE_ECDH_USE = 0x00080000; /* If set, always create a new key when using tmp_dh parameters */ publicstaticfinalint SSL_OP_SINGLE_DH_USE = 0x00100000; /* Set to always use the tmp_rsa key when doing RSA operations,
* even when this violates protocol specs */ publicstaticfinalint SSL_OP_EPHEMERAL_RSA = 0x00200000; /* Set on servers to choose the cipher according to the server's
* preferences */ publicstaticfinalint SSL_OP_CIPHER_SERVER_PREFERENCE = 0x00400000; /* If set, a server will allow a client to issue an SSLv3.0 version number * as latest version supported in the premaster secret, even when TLSv1.0 * (version 3.1) was announced in the client hello. Normally this is
* forbidden to prevent version rollback attacks. */ publicstaticfinalint SSL_OP_TLS_ROLLBACK_BUG = 0x00800000;
/* Return OpenSSL version number (compile time version, if version < 1.1.0) */ publicstaticnativeint version();
/* Return OpenSSL version string (run time version) */ publicstaticnative String versionString();
/** * Initialize OpenSSL support. * This function needs to be called once for the * lifetime of JVM. Library.init() has to be called before. * @param engine Support for external a Crypto Device ("engine"), * usually * a hardware accelerator card for crypto operations. * @return APR status code
*/ publicstaticnativeint initialize(String engine);
/** * Get the status of FIPS Mode. * * @return FIPS_mode return code. It is <code>0</code> if OpenSSL is not * in FIPS mode, <code>1</code> if OpenSSL is in FIPS Mode. * @throws Exception If tcnative was not compiled with FIPS Mode available. * @see <a href="http://wiki.openssl.org/index.php/FIPS_mode%28%29">OpenSSL method FIPS_mode()</a>
*/ publicstaticnativeint fipsModeGet() throws Exception;
/** * Enable/Disable FIPS Mode. * * @param mode 1 - enable, 0 - disable * * @return FIPS_mode_set return code * @throws Exception If tcnative was not compiled with FIPS Mode available, * or if {@code FIPS_mode_set()} call returned an error value. * @see <a href="http://wiki.openssl.org/index.php/FIPS_mode_set%28%29">OpenSSL method FIPS_mode_set()</a>
*/ publicstaticnativeint fipsModeSet(int mode) throws Exception;
/** * Sets global random filename. * * @param filename Filename to use. * If set it will be used for SSL initialization * and all contexts where explicitly not set.
*/ publicstaticnativevoid randSet(String filename);
/** * Return the handshake completed count. * @param ssl SSL pointer * @return the count
*/ publicstaticnativeint getHandshakeCount(long ssl);
/** * SSL_new * @param ctx Server or Client context to use. * @param server if true configure SSL instance to use accept handshake routines * if false configure SSL instance to use connect handshake routines * @return pointer to SSL instance (SSL *)
*/ publicstaticnativelong newSSL(long ctx, boolean server);
/** * BIO_ctrl_pending. * @param bio BIO pointer (BIO *) * @return the pending bytes count
*/ publicstaticnativeint pendingWrittenBytesInBIO(long bio);
/** * Wire up internal and network BIOs for the given SSL instance. * * <b>Warning: you must explicitly free this resource by calling freeBIO</b> * * While the SSL's internal/application data BIO will be freed when freeSSL is called on * the provided SSL instance, you must call freeBIO on the returned network BIO. * * @param ssl the SSL instance (SSL *) * @return pointer to the Network BIO (BIO *)
*/ publicstaticnativelong makeNetworkBIO(long ssl);
/** * BIO_free * @param bio BIO pointer
*/ publicstaticnativevoid freeBIO(long bio);
/** * SSL_shutdown * @param ssl the SSL instance (SSL *) * @return the operation status
*/ publicstaticnativeint shutdownSSL(long ssl);
/** * Get the error number representing the last error OpenSSL encountered on * this thread. * @return the last error number
*/ publicstaticnativeint getLastErrorNumber();
/** * SSL_get_cipher. * @param ssl the SSL instance (SSL *) * @return the cipher name
*/ publicstaticnative String getCipherForSSL(long ssl);
/** * SSL_get_version * @param ssl the SSL instance (SSL *) * @return the SSL version in use
*/ publicstaticnative String getVersion(long ssl);
/** * SSL_do_handshake * @param ssl the SSL instance (SSL *) * @return the handshake status
*/ publicstaticnativeint doHandshake(long ssl);
/** * SSL_renegotiate * @param ssl the SSL instance (SSL *) * @return the operation status
*/ publicstaticnativeint renegotiate(long ssl);
/** * SSL_renegotiate_pending * @param ssl the SSL instance (SSL *) * @return the operation status
*/ publicstaticnativeint renegotiatePending(long ssl);
/** * SSL_verify_client_post_handshake * @param ssl the SSL instance (SSL *) * @return the operation status
*/ publicstaticnativeint verifyClientPostHandshake(long ssl);
/** * Is post handshake authentication in progress on this connection? * @param ssl the SSL instance (SSL *) * @return the operation status
*/ publicstaticnativeint getPostHandshakeAuthInProgress(long ssl);
/** * SSL_in_init. * @param ssl the SSL instance (SSL *) * @return the status
*/ publicstaticnativeint isInInit(long ssl);
/** * Get the peer certificate chain or {@code null} if non was send. * @param ssl the SSL instance (SSL *) * @return the certificate chain bytes
*/ publicstaticnativebyte[][] getPeerCertChain(long ssl);
/** * Get the peer certificate or {@code null} if non was send. * @param ssl the SSL instance (SSL *) * @return the certificate bytes
*/ publicstaticnativebyte[] getPeerCertificate(long ssl);
/** * Get the error number representing for the given {@code errorNumber}. * @param errorNumber The error code * @return an error message
*/ publicstaticnative String getErrorString(long errorNumber);
/** * SSL_get_time * @param ssl the SSL instance (SSL *) * @return returns the time at which the session ssl was established. The time is given in seconds since the Epoch
*/ publicstaticnativelong getTime(long ssl);
/** * Set Type of Client Certificate verification and Maximum depth of CA Certificates * in Client Certificate verification. * <br> * This directive sets the Certificate verification level for the Client * Authentication. Notice that this directive can be used both in per-server * and per-directory context. In per-server context it applies to the client * authentication process used in the standard SSL handshake when a connection * is established. In per-directory context it forces an SSL renegotiation with * the reconfigured client verification level after the HTTP request was read * but before the HTTP response is sent. * <br> * The following levels are available for level: * <pre> * SSL_CVERIFY_NONE - No client Certificate is required at all * SSL_CVERIFY_OPTIONAL - The client may present a valid Certificate * SSL_CVERIFY_REQUIRE - The client has to present a valid Certificate * SSL_CVERIFY_OPTIONAL_NO_CA - The client may present a valid Certificate * but it need not to be (successfully) verifiable * </pre> * <br> * The depth actually is the maximum number of intermediate certificate issuers, * i.e. the number of CA certificates which are max allowed to be followed while * verifying the client certificate. A depth of 0 means that self-signed client * certificates are accepted only, the default depth of 1 means the client * certificate can be self-signed or has to be signed by a CA which is directly * known to the server (i.e. the CA's certificate is under * {@code setCACertificatePath}, etc. * * @param ssl the SSL instance (SSL *) * @param level Type of Client Certificate verification. * @param depth Maximum depth of CA Certificates in Client Certificate * verification.
*/ publicstaticnativevoid setVerify(long ssl, int level, int depth);
/** * Set OpenSSL Option. * @param ssl the SSL instance (SSL *) * @param options See SSL.SSL_OP_* for option flags.
*/ publicstaticnativevoid setOptions(long ssl, int options);
/** * Get OpenSSL Option. * @param ssl the SSL instance (SSL *) * @return options See SSL.SSL_OP_* for option flags.
*/ publicstaticnativeint getOptions(long ssl);
/** * Returns all cipher suites that are enabled for negotiation in an SSL handshake. * @param ssl the SSL instance (SSL *) * @return ciphers
*/ publicstaticnative String[] getCiphers(long ssl);
/** * Returns the cipher suites available for negotiation in SSL handshake. * <br> * This complex directive uses a colon-separated cipher-spec string consisting * of OpenSSL cipher specifications to configure the Cipher Suite the client * is permitted to negotiate in the SSL handshake phase. Notice that this * directive can be used both in per-server and per-directory context. * In per-server context it applies to the standard SSL handshake when a * connection is established. In per-directory context it forces an SSL * renegotiation with the reconfigured Cipher Suite after the HTTP request * was read but before the HTTP response is sent. * @param ssl the SSL instance (SSL *) * @param ciphers an SSL cipher specification * @return <code>true</code> if the operation was successful * @throws Exception An error occurred
*/ publicstaticnativeboolean setCipherSuites(long ssl, String ciphers) throws Exception;
/** * Returns the ID of the session as byte array representation. * * @param ssl the SSL instance (SSL *) * @return the session as byte array representation obtained via SSL_SESSION_get_id.
*/ publicstaticnativebyte[] getSessionId(long ssl);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.