• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  */
16 package com.android.org.conscrypt;
17 
18 import java.io.FileDescriptor;
19 import java.io.IOException;
20 import java.io.InputStream;
21 import java.io.OutputStream;
22 import java.net.InetAddress;
23 import java.net.Socket;
24 import java.net.SocketException;
25 import java.security.PrivateKey;
26 import java.security.cert.CertificateEncodingException;
27 import java.security.cert.CertificateException;
28 import javax.net.ssl.HandshakeCompletedListener;
29 import javax.net.ssl.SSLException;
30 import javax.net.ssl.SSLSession;
31 
32 /**
33  * Implementation of the class OpenSSLSocketImpl based on OpenSSL.
34  * <p>
35  * Extensions to SSLSocket include:
36  * <ul>
37  * <li>handshake timeout
38  * <li>session tickets
39  * <li>Server Name Indication
40  * </ul>
41  */
42 public class OpenSSLSocketImpl
43         extends javax.net.ssl.SSLSocket implements NativeCrypto.SSLHandshakeCallbacks {
OpenSSLSocketImpl(SSLParametersImpl sslParameters)44     protected OpenSSLSocketImpl(SSLParametersImpl sslParameters) throws IOException {
45         throw new RuntimeException("Stub!");
46     }
47 
OpenSSLSocketImpl(SSLParametersImpl sslParameters, String[] enabledProtocols, String[] enabledCipherSuites)48     protected OpenSSLSocketImpl(SSLParametersImpl sslParameters, String[] enabledProtocols,
49             String[] enabledCipherSuites) throws IOException {
50         throw new RuntimeException("Stub!");
51     }
52 
OpenSSLSocketImpl(String host, int port, SSLParametersImpl sslParameters)53     protected OpenSSLSocketImpl(String host, int port, SSLParametersImpl sslParameters)
54             throws IOException {
55         throw new RuntimeException("Stub!");
56     }
57 
OpenSSLSocketImpl(InetAddress address, int port, SSLParametersImpl sslParameters)58     protected OpenSSLSocketImpl(InetAddress address, int port, SSLParametersImpl sslParameters)
59             throws IOException {
60         throw new RuntimeException("Stub!");
61     }
62 
OpenSSLSocketImpl(String host, int port, InetAddress clientAddress, int clientPort, SSLParametersImpl sslParameters)63     protected OpenSSLSocketImpl(String host, int port, InetAddress clientAddress, int clientPort,
64             SSLParametersImpl sslParameters) throws IOException {
65         throw new RuntimeException("Stub!");
66     }
67 
OpenSSLSocketImpl(InetAddress address, int port, InetAddress clientAddress, int clientPort, SSLParametersImpl sslParameters)68     protected OpenSSLSocketImpl(InetAddress address, int port, InetAddress clientAddress,
69             int clientPort, SSLParametersImpl sslParameters) throws IOException {
70         throw new RuntimeException("Stub!");
71     }
72 
OpenSSLSocketImpl(Socket socket, String host, int port, boolean autoClose, SSLParametersImpl sslParameters)73     protected OpenSSLSocketImpl(Socket socket, String host, int port, boolean autoClose,
74             SSLParametersImpl sslParameters) throws IOException {
75         throw new RuntimeException("Stub!");
76     }
77 
78     @Override
startHandshake()79     public synchronized void startHandshake() throws IOException {
80         throw new RuntimeException("Stub!");
81     }
82 
83     @SuppressWarnings("unused") // used by NativeCrypto.SSLHandshakeCallbacks / client_cert_cb
84     @Override
clientCertificateRequested(byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals)85     public void clientCertificateRequested(byte[] keyTypeBytes, byte[][] asn1DerEncodedPrincipals)
86             throws CertificateEncodingException, SSLException {
87         throw new RuntimeException("Stub!");
88     }
89 
90     @SuppressWarnings("unused") // used by NativeCrypto.SSLHandshakeCallbacks / info_callback
91     @Override
handshakeCompleted()92     public void handshakeCompleted() {
93         throw new RuntimeException("Stub!");
94     }
95 
96     @SuppressWarnings("unused") // used by NativeCrypto.SSLHandshakeCallbacks
97     @Override
verifyCertificateChain(byte[][] bytes, String authMethod)98     public void verifyCertificateChain(byte[][] bytes, String authMethod)
99             throws CertificateException {
100         throw new RuntimeException("Stub!");
101     }
102 
103     @Override
getInputStream()104     public InputStream getInputStream() throws IOException {
105         throw new RuntimeException("Stub!");
106     }
107 
108     @Override
getOutputStream()109     public OutputStream getOutputStream() throws IOException {
110         throw new RuntimeException("Stub!");
111     }
112 
113     @Override
getSession()114     public SSLSession getSession() {
115         throw new RuntimeException("Stub!");
116     }
117 
118     @Override
addHandshakeCompletedListener(HandshakeCompletedListener listener)119     public void addHandshakeCompletedListener(HandshakeCompletedListener listener) {
120         throw new RuntimeException("Stub!");
121     }
122 
123     @Override
removeHandshakeCompletedListener(HandshakeCompletedListener listener)124     public void removeHandshakeCompletedListener(HandshakeCompletedListener listener) {
125         throw new RuntimeException("Stub!");
126     }
127 
128     @Override
getEnableSessionCreation()129     public boolean getEnableSessionCreation() {
130         throw new RuntimeException("Stub!");
131     }
132 
133     @Override
setEnableSessionCreation(boolean flag)134     public void setEnableSessionCreation(boolean flag) {
135         throw new RuntimeException("Stub!");
136     }
137 
138     @Override
getSupportedCipherSuites()139     public String[] getSupportedCipherSuites() {
140         throw new RuntimeException("Stub!");
141     }
142 
143     @Override
getEnabledCipherSuites()144     public String[] getEnabledCipherSuites() {
145         throw new RuntimeException("Stub!");
146     }
147 
148     @Override
setEnabledCipherSuites(String[] suites)149     public void setEnabledCipherSuites(String[] suites) {
150         throw new RuntimeException("Stub!");
151     }
152 
153     @Override
getSupportedProtocols()154     public String[] getSupportedProtocols() {
155         throw new RuntimeException("Stub!");
156     }
157 
158     @Override
getEnabledProtocols()159     public String[] getEnabledProtocols() {
160         throw new RuntimeException("Stub!");
161     }
162 
163     @Override
setEnabledProtocols(String[] protocols)164     public void setEnabledProtocols(String[] protocols) {
165         throw new RuntimeException("Stub!");
166     }
setUseSessionTickets(boolean useSessionTickets)167     public void setUseSessionTickets(boolean useSessionTickets) {
168         throw new RuntimeException("Stub!");
169     }
170 
setHostname(String hostname)171     public void setHostname(String hostname) {
172         throw new RuntimeException("Stub!");
173     }
174 
setChannelIdEnabled(boolean enabled)175     public void setChannelIdEnabled(boolean enabled) {
176         throw new RuntimeException("Stub!");
177     }
178 
getChannelId()179     public byte[] getChannelId() throws SSLException {
180         throw new RuntimeException("Stub!");
181     }
182 
setChannelIdPrivateKey(PrivateKey privateKey)183     public void setChannelIdPrivateKey(PrivateKey privateKey) {
184         throw new RuntimeException("Stub!");
185     }
186 
187     @Override
getUseClientMode()188     public boolean getUseClientMode() {
189         throw new RuntimeException("Stub!");
190     }
191 
192     @Override
setUseClientMode(boolean mode)193     public void setUseClientMode(boolean mode) {
194         throw new RuntimeException("Stub!");
195     }
196 
197     @Override
getWantClientAuth()198     public boolean getWantClientAuth() {
199         throw new RuntimeException("Stub!");
200     }
201 
202     @Override
getNeedClientAuth()203     public boolean getNeedClientAuth() {
204         throw new RuntimeException("Stub!");
205     }
206 
207     @Override
setNeedClientAuth(boolean need)208     public void setNeedClientAuth(boolean need) {
209         throw new RuntimeException("Stub!");
210     }
211 
212     @Override
setWantClientAuth(boolean want)213     public void setWantClientAuth(boolean want) {
214         throw new RuntimeException("Stub!");
215     }
216 
217     @Override
sendUrgentData(int data)218     public void sendUrgentData(int data) throws IOException {
219         throw new RuntimeException("Stub!");
220     }
221 
222     @Override
setOOBInline(boolean on)223     public void setOOBInline(boolean on) throws SocketException {
224         throw new RuntimeException("Stub!");
225     }
226 
227     @SuppressWarnings("UnsynchronizedOverridesSynchronized")
228     @Override
setSoTimeout(int readTimeoutMilliseconds)229     public void setSoTimeout(int readTimeoutMilliseconds) throws SocketException {
230         throw new RuntimeException("Stub!");
231     }
232 
233     @SuppressWarnings("UnsynchronizedOverridesSynchronized")
234     @Override
getSoTimeout()235     public int getSoTimeout() throws SocketException {
236         throw new RuntimeException("Stub!");
237     }
238 
239     /**
240      * Note write timeouts are not part of the javax.net.ssl.SSLSocket API
241      */
setSoWriteTimeout(int writeTimeoutMilliseconds)242     public void setSoWriteTimeout(int writeTimeoutMilliseconds) throws SocketException {
243         throw new RuntimeException("Stub!");
244     }
245 
246     /**
247      * Note write timeouts are not part of the javax.net.ssl.SSLSocket API
248      */
getSoWriteTimeout()249     public int getSoWriteTimeout() throws SocketException {
250         throw new RuntimeException("Stub!");
251     }
252 
253     /**
254      * Set the handshake timeout on this socket.  This timeout is specified in
255      * milliseconds and will be used only during the handshake process.
256      */
setHandshakeTimeout(int handshakeTimeoutMilliseconds)257     public void setHandshakeTimeout(int handshakeTimeoutMilliseconds) throws SocketException {
258         throw new RuntimeException("Stub!");
259     }
260 
261     @SuppressWarnings("UnsynchronizedOverridesSynchronized")
262     @Override
close()263     public void close() throws IOException {
264         throw new RuntimeException("Stub!");
265     }
266 
getFileDescriptor$()267     public FileDescriptor getFileDescriptor$() {
268         throw new RuntimeException("Stub!");
269     }
270 
getNpnSelectedProtocol()271     public byte[] getNpnSelectedProtocol() {
272         throw new RuntimeException("Stub!");
273     }
274 
setNpnProtocols(byte[] npnProtocols)275     public void setNpnProtocols(byte[] npnProtocols) {
276         throw new RuntimeException("Stub!");
277     }
278 }
279