1/* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package com.android.org.conscrypt; 17 18import java.io.FileDescriptor; 19import java.io.IOException; 20import java.io.InputStream; 21import java.io.OutputStream; 22import java.net.InetAddress; 23import java.net.Socket; 24import java.net.SocketException; 25import java.security.PrivateKey; 26import java.security.cert.CertificateEncodingException; 27import java.security.cert.CertificateException; 28import javax.net.ssl.HandshakeCompletedEvent; 29import javax.net.ssl.HandshakeCompletedListener; 30import javax.net.ssl.SSLException; 31import javax.net.ssl.SSLSession; 32 33 34 35/** 36 * Implementation of the class OpenSSLSocketImpl based on OpenSSL. 37 * <p> 38 * Extensions to SSLSocket include: 39 * <ul> 40 * <li>handshake timeout 41 * <li>session tickets 42 * <li>Server Name Indication 43 * </ul> 44 */ 45public class OpenSSLSocketImpl 46 extends javax.net.ssl.SSLSocket 47 implements NativeCrypto.SSLHandshakeCallbacks { 48 49 50 protected OpenSSLSocketImpl(SSLParametersImpl sslParameters) throws IOException { 51 throw new RuntimeException("Stub!"); 52 } 53 54 protected OpenSSLSocketImpl(SSLParametersImpl sslParameters, 55 String[] enabledProtocols, 56 String[] enabledCipherSuites) throws IOException { 57 throw new RuntimeException("Stub!"); 58 } 59 60 protected OpenSSLSocketImpl(String host, int port, SSLParametersImpl sslParameters) 61 throws IOException { 62 throw new RuntimeException("Stub!"); 63 } 64 65 protected OpenSSLSocketImpl(InetAddress address, int port, SSLParametersImpl sslParameters) 66 throws IOException { 67 throw new RuntimeException("Stub!"); 68 } 69 70 71 protected OpenSSLSocketImpl(String host, int port, 72 InetAddress clientAddress, int clientPort, 73 SSLParametersImpl sslParameters) throws IOException { 74 throw new RuntimeException("Stub!"); 75 } 76 77 protected OpenSSLSocketImpl(InetAddress address, int port, 78 InetAddress clientAddress, int clientPort, 79 SSLParametersImpl sslParameters) throws IOException { 80 throw new RuntimeException("Stub!"); 81 } 82 83 protected OpenSSLSocketImpl(Socket socket, String host, int port, 84 boolean autoClose, SSLParametersImpl sslParameters) throws IOException { 85 throw new RuntimeException("Stub!"); 86 } 87 88 @Override public synchronized void startHandshake() throws IOException { 89 throw new RuntimeException("Stub!"); 90 } 91 92 @SuppressWarnings("unused") // used by NativeCrypto.SSLHandshakeCallbacks / client_cert_cb 93 public void clientCertificateRequested(byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals) 94 throws CertificateEncodingException, SSLException { 95 throw new RuntimeException("Stub!"); 96 } 97 98 @SuppressWarnings("unused") // used by NativeCrypto.SSLHandshakeCallbacks / info_callback 99 public void handshakeCompleted() { 100 throw new RuntimeException("Stub!"); 101 } 102 @SuppressWarnings("unused") // used by NativeCrypto.SSLHandshakeCallbacks 103 @Override public void verifyCertificateChain(byte[][] bytes, String authMethod) 104 throws CertificateException { 105 throw new RuntimeException("Stub!"); 106 } 107 108 @Override public InputStream getInputStream() throws IOException { 109 throw new RuntimeException("Stub!"); 110 } 111 112 @Override public OutputStream getOutputStream() throws IOException { 113 throw new RuntimeException("Stub!"); 114 } 115 @Override public SSLSession getSession() { 116 throw new RuntimeException("Stub!"); 117 } 118 119 @Override public void addHandshakeCompletedListener( 120 HandshakeCompletedListener listener) { 121 throw new RuntimeException("Stub!"); 122 } 123 124 @Override public void removeHandshakeCompletedListener( 125 HandshakeCompletedListener listener) { 126 throw new RuntimeException("Stub!"); 127 } 128 129 @Override public boolean getEnableSessionCreation() { 130 throw new RuntimeException("Stub!"); 131 } 132 133 @Override public void setEnableSessionCreation(boolean flag) { 134 throw new RuntimeException("Stub!"); 135 } 136 137 @Override public String[] getSupportedCipherSuites() { 138 throw new RuntimeException("Stub!"); 139 } 140 141 @Override public String[] getEnabledCipherSuites() { 142 throw new RuntimeException("Stub!"); 143 } 144 145 @Override public void setEnabledCipherSuites(String[] suites) { 146 throw new RuntimeException("Stub!"); 147 } 148 149 @Override public String[] getSupportedProtocols() { 150 throw new RuntimeException("Stub!"); 151 } 152 153 @Override public String[] getEnabledProtocols() { 154 throw new RuntimeException("Stub!"); 155 } 156 157 @Override public void setEnabledProtocols(String[] protocols) { 158 throw new RuntimeException("Stub!"); 159 } 160 public void setUseSessionTickets(boolean useSessionTickets) { 161 throw new RuntimeException("Stub!"); 162 } 163 164 public void setHostname(String hostname) { 165 throw new RuntimeException("Stub!"); 166 } 167 168 public void setChannelIdEnabled(boolean enabled) { 169 throw new RuntimeException("Stub!"); 170 } 171 172 public byte[] getChannelId() throws SSLException { 173 throw new RuntimeException("Stub!"); 174 } 175 public void setChannelIdPrivateKey(PrivateKey privateKey) { 176 throw new RuntimeException("Stub!"); 177 } 178 179 @Override public boolean getUseClientMode() { 180 throw new RuntimeException("Stub!"); 181 } 182 183 @Override public void setUseClientMode(boolean mode) { 184 throw new RuntimeException("Stub!"); 185 } 186 187 @Override public boolean getWantClientAuth() { 188 throw new RuntimeException("Stub!"); 189 } 190 191 @Override public boolean getNeedClientAuth() { 192 throw new RuntimeException("Stub!"); 193 } 194 195 @Override public void setNeedClientAuth(boolean need) { 196 throw new RuntimeException("Stub!"); 197 } 198 199 @Override public void setWantClientAuth(boolean want) { 200 throw new RuntimeException("Stub!"); 201 } 202 203 @Override public void sendUrgentData(int data) throws IOException { 204 throw new RuntimeException("Stub!"); 205 } 206 207 @Override public void setOOBInline(boolean on) throws SocketException { 208 throw new RuntimeException("Stub!"); 209 } 210 211 @Override public void setSoTimeout(int readTimeoutMilliseconds) throws SocketException { 212 throw new RuntimeException("Stub!"); 213 } 214 215 @Override public int getSoTimeout() throws SocketException { 216 throw new RuntimeException("Stub!"); 217 } 218 219 /** 220 * Note write timeouts are not part of the javax.net.ssl.SSLSocket API 221 */ 222 public void setSoWriteTimeout(int writeTimeoutMilliseconds) throws SocketException { 223 throw new RuntimeException("Stub!"); 224 } 225 226 /** 227 * Note write timeouts are not part of the javax.net.ssl.SSLSocket API 228 */ 229 public int getSoWriteTimeout() throws SocketException { 230 throw new RuntimeException("Stub!"); 231 } 232 233 /** 234 * Set the handshake timeout on this socket. This timeout is specified in 235 * milliseconds and will be used only during the handshake process. 236 */ 237 public void setHandshakeTimeout(int handshakeTimeoutMilliseconds) throws SocketException { 238 throw new RuntimeException("Stub!"); 239 } 240 241 @Override public void close() throws IOException { 242 throw new RuntimeException("Stub!"); 243 } 244 245 public FileDescriptor getFileDescriptor$() { 246 throw new RuntimeException("Stub!"); 247 } 248 249 /** 250 * Returns the protocol agreed upon by client and server, or null if no 251 * protocol was agreed upon. 252 */ 253 public byte[] getNpnSelectedProtocol() { 254 throw new RuntimeException("Stub!"); 255 } 256 257 /** 258 * Sets the list of protocols this peer is interested in. If null no 259 * protocols will be used. 260 * 261 * @param npnProtocols a non-empty array of protocol names. From 262 * SSL_select_next_proto, "vector of 8-bit, length prefixed byte 263 * strings. The length byte itself is not included in the length. A byte 264 * string of length 0 is invalid. No byte string may be truncated.". 265 */ 266 public void setNpnProtocols(byte[] npnProtocols) { 267 throw new RuntimeException("Stub!"); 268 } 269} 270