Use correct path separator for satellite assemblies in cross builds (#4976)
[mono.git] / mcs / class / System / System.Net.Security / SslStream.platformnotsupported.cs
1 //
2 // SslStream.cs
3 //
4 // Author:
5 //       Rolf Bjarne Kvinge <rolf@xamarin.com>
6 //
7 // Copyright (c) 2016 Xamarin, Inc.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
26
27 using System.IO;
28 using System.Security.Authentication;
29 using System.Security.Cryptography.X509Certificates;
30 using System.Threading.Tasks;
31
32 namespace System.Net.Security
33 {
34         /*
35          * These two are defined by the referencesource; add them here to make
36          * it easy to switch between the two implementations.
37          */
38
39         internal delegate bool RemoteCertValidationCallback (
40                 string host,
41                 X509Certificate certificate,
42                 X509Chain chain,
43                 SslPolicyErrors sslPolicyErrors);
44
45         internal delegate X509Certificate LocalCertSelectionCallback (
46                 string targetHost,
47                 X509CertificateCollection localCertificates,
48                 X509Certificate remoteCertificate,
49                 string[] acceptableIssuers);
50
51         public class SslStream : AuthenticatedStream
52         {
53                 const string EXCEPTION_MESSAGE = "System.Net.Security.SslStream is not supported on the current platform.";
54
55                 public SslStream (Stream innerStream)
56                         : this (innerStream, false)
57                 {
58                 }
59
60                 public SslStream (Stream innerStream, bool leaveInnerStreamOpen)
61                         : base (innerStream, leaveInnerStreamOpen)
62                 {
63                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
64                 }
65
66                 public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback)
67                         : this (innerStream, leaveInnerStreamOpen)
68                 {
69                 }
70
71                 public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback)
72                         : this (innerStream, leaveInnerStreamOpen)
73                 {
74                 }
75
76                 public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback, EncryptionPolicy encryptionPolicy)
77                         : this (innerStream, leaveInnerStreamOpen)
78                 {
79                 }
80
81                 public virtual void AuthenticateAsClient (string targetHost)
82                 {
83                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
84                 }
85
86                 public virtual void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
87                 {
88                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
89                 }
90
91                 public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
92                 {
93                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
94                 }
95
96                 public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
97                 {
98                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
99                 }
100
101                 public virtual void EndAuthenticateAsClient (IAsyncResult asyncResult)
102                 {
103                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
104                 }
105
106                 public virtual void AuthenticateAsServer (X509Certificate serverCertificate)
107                 {
108                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
109                 }
110
111                 public virtual void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
112                 {
113                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
114                 }
115
116                 public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
117                 {
118                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
119                 }
120
121                 public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
122                 {
123                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
124                 }
125
126                 public virtual void EndAuthenticateAsServer (IAsyncResult asyncResult)
127                 {
128                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
129                 }
130
131                 public TransportContext TransportContext {
132                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
133                 }
134
135                 public virtual Task AuthenticateAsClientAsync (string targetHost)
136                 {
137                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
138                 }
139
140                 public virtual Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
141                 {
142                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
143                 }
144
145                 public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
146                 {
147                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
148                 }
149
150                 public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
151                 {
152                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
153                 }
154
155                 public override bool IsAuthenticated {
156                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
157                 }
158
159                 public override bool IsMutuallyAuthenticated {
160                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
161                 }
162
163                 public override bool IsEncrypted {
164                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
165                 }
166
167                 public override bool IsSigned {
168                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
169                 }
170
171                 public override bool IsServer {
172                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
173                 }
174
175                 public virtual SslProtocols SslProtocol {
176                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
177                 }
178
179                 public virtual bool CheckCertRevocationStatus {
180                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
181                 }
182
183                 public virtual X509Certificate LocalCertificate {
184                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
185                 }
186
187                 public virtual X509Certificate RemoteCertificate {
188                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
189                 }
190
191                 public virtual CipherAlgorithmType CipherAlgorithm {
192                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
193                 }
194
195                 public virtual int CipherStrength {
196                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
197                 }
198
199                 public virtual HashAlgorithmType HashAlgorithm {
200                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
201                 }
202
203                 public virtual int HashStrength {
204                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
205                 }
206
207                 public virtual ExchangeAlgorithmType KeyExchangeAlgorithm {
208                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
209                 }
210
211                 public virtual int KeyExchangeStrength {
212                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
213                 }
214
215                 public override bool CanSeek {
216                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
217                 }
218
219                 public override bool CanRead {
220                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
221                 }
222
223                 public override bool CanTimeout {
224                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
225                 }
226
227                 public override bool CanWrite {
228                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
229                 }
230
231                 public override int ReadTimeout {
232                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
233                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
234                 }
235
236                 public override int WriteTimeout {
237                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
238                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
239                 }
240
241                 public override long Length {
242                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
243                 }
244
245                 public override long Position {
246                         get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
247                         set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
248                 }
249
250                 public override void SetLength (long value)
251                 {
252                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
253                 }
254
255                 public override long Seek (long offset, SeekOrigin origin)
256                 {
257                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
258                 }
259
260                 public override void Flush ()
261                 {
262                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
263                 }
264
265                 protected override void Dispose (bool disposing)
266                 {
267                 }
268
269                 public override int Read (byte[] buffer, int offset, int count)
270                 {
271                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
272                 }
273
274                 public void Write (byte[] buffer)
275                 {
276                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
277                 }
278
279                 public override void Write (byte[] buffer, int offset, int count)
280                 {
281                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
282                 }
283
284                 public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
285                 {
286                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
287                 }
288
289                 public override int EndRead (IAsyncResult asyncResult)
290                 {
291                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
292                 }
293
294                 public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
295                 {
296                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
297                 }
298
299                 public override void EndWrite (IAsyncResult asyncResult)
300                 {
301                         throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
302                 }
303         }
304 }