| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Licensed to the Apache Software Foundation (ASF) under one or more | |
| 3 * contributor license agreements. See the NOTICE file distributed with | |
| 4 * this work for additional information regarding copyright ownership. | |
| 5 * The ASF licenses this file to You under the Apache License, Version 2.0 | |
| 6 * (the "License"); you may not use this file except in compliance with | |
| 7 * the License. You may obtain a copy of the License at | |
| 8 * | |
| 9 * http://www.apache.org/licenses/LICENSE-2.0 | |
| 10 * | |
| 11 * Unless required by applicable law or agreed to in writing, software | |
| 12 * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 * See the License for the specific language governing permissions and | |
| 15 * limitations under the License. | |
| 16 */ | |
| 17 | |
| 18 package org.apache.tomcat.jni; | |
| 19 | |
| 20 /** SSL Socket | |
| 21 * | |
| 22 * @author Mladen Turk | |
| 23 */ | |
| 24 public class SSLSocket { | |
| 25 | |
| 26 /** | |
| 27 * Attach APR socket on a SSL connection. | |
| 28 * @param ctx SSLContext to use. | |
| 29 * @param sock APR Socket that already did physical connect or accept. | |
| 30 * @return APR_STATUS code. | |
| 31 */ | |
| 32 public static native int attach(long ctx, long sock) | |
| 33 throws Exception; | |
| 34 | |
| 35 /** | |
| 36 * Do a SSL handshake. | |
| 37 * @param thesocket The socket to use | |
| 38 */ | |
| 39 public static native int handshake(long thesocket); | |
| 40 | |
| 41 /** | |
| 42 * Do a SSL renegotiation. | |
| 43 * SSL supports per-directory re-configuration of SSL parameters. | |
| 44 * This is implemented by performing an SSL renegotiation of the | |
| 45 * re-configured parameters after the request is read, but before the | |
| 46 * response is sent. In more detail: the renegotiation happens after the | |
| 47 * request line and MIME headers were read, but _before_ the attached | |
| 48 * request body is read. The reason simply is that in the HTTP protocol | |
| 49 * usually there is no acknowledgment step between the headers and the | |
| 50 * body (there is the 100-continue feature and the chunking facility | |
| 51 * only), so Apache has no API hook for this step. | |
| 52 * | |
| 53 * @param thesocket The socket to use | |
| 54 */ | |
| 55 public static native int renegotiate(long thesocket); | |
| 56 | |
| 57 /** | |
| 58 * Set Type of Client Certificate verification and Maximum depth of CA | |
| 59 * Certificates in Client Certificate verification. | |
| 60 * <br> | |
| 61 * This is used to change the verification level for a connection prior to | |
| 62 * starting a re-negotiation. | |
| 63 * <br> | |
| 64 * The following levels are available for level: | |
| 65 * <PRE> | |
| 66 * SSL_CVERIFY_NONE - No client Certificate is required at all | |
| 67 * SSL_CVERIFY_OPTIONAL - The client may present a valid Certificate | |
| 68 * SSL_CVERIFY_REQUIRE - The client has to present a valid | |
| 69 * Certificate | |
| 70 * SSL_CVERIFY_OPTIONAL_NO_CA - The client may present a valid Certificate | |
| 71 * but it need not to be (successfully) | |
| 72 * verifiable | |
| 73 * </PRE> | |
| 74 * <br> | |
| 75 * @param sock The socket to change. | |
| 76 * @param level Type of Client Certificate verification. | |
| 77 */ | |
| 78 public static native void setVerify(long sock, int level, int depth); | |
| 79 | |
| 80 /** | |
| 81 * Return SSL Info parameter as byte array. | |
| 82 * | |
| 83 * @param sock The socket to read the data from. | |
| 84 * @param id Parameter id. | |
| 85 * @return Byte array containing info id value. | |
| 86 */ | |
| 87 public static native byte[] getInfoB(long sock, int id) | |
| 88 throws Exception; | |
| 89 | |
| 90 /** | |
| 91 * Return SSL Info parameter as String. | |
| 92 * | |
| 93 * @param sock The socket to read the data from. | |
| 94 * @param id Parameter id. | |
| 95 * @return String containing info id value. | |
| 96 */ | |
| 97 public static native String getInfoS(long sock, int id) | |
| 98 throws Exception; | |
| 99 | |
| 100 /** | |
| 101 * Return SSL Info parameter as integer. | |
| 102 * | |
| 103 * @param sock The socket to read the data from. | |
| 104 * @param id Parameter id. | |
| 105 * @return Integer containing info id value or -1 on error. | |
| 106 */ | |
| 107 public static native int getInfoI(long sock, int id) | |
| 108 throws Exception; | |
| 109 | |
| 110 } | |
| OLD | NEW |