[System.Runtime.Remoting] Adds System.Core reference for tests
[mono.git] / mcs / class / Mono.Security / Mono.Security.Interface / IMonoSslStream.cs
1 //
2 // IMonoSslStream.cs
3 //
4 // Author:
5 //       Martin Baulig <martin.baulig@xamarin.com>
6 //
7 // Copyright (c) 2015 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 using System;
27 using System.IO;
28 using System.Net;
29 using System.Net.Security;
30 using System.Threading;
31 using System.Threading.Tasks;
32 using SSA = System.Security.Authentication;
33 using System.Security.Cryptography.X509Certificates;
34 using System.Security.Principal;
35 using System.Security.Cryptography;
36 using Mono.Net.Security;
37
38 namespace Mono.Security.Interface
39 {
40         public interface IMonoSslStream : IDisposable
41         {
42                 SslStream SslStream {
43                         get;
44                 }
45
46                 void AuthenticateAsClient (string targetHost);
47
48                 void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
49
50                 IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState);
51
52                 IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
53
54                 void EndAuthenticateAsClient (IAsyncResult asyncResult);
55
56                 void AuthenticateAsServer (X509Certificate serverCertificate);
57
58                 void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
59
60                 IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState);
61
62                 IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState);
63
64                 void EndAuthenticateAsServer (IAsyncResult asyncResult);
65
66                 Task AuthenticateAsClientAsync (string targetHost);
67
68                 Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
69
70                 Task AuthenticateAsServerAsync (X509Certificate serverCertificate);
71
72                 Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SSA.SslProtocols enabledSslProtocols, bool checkCertificateRevocation);
73
74                 void Flush ();
75
76                 int Read (byte[] buffer, int offset, int count);
77
78                 void Write (byte[] buffer);
79
80                 void Write (byte[] buffer, int offset, int count);
81
82                 IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState);
83
84                 int EndRead (IAsyncResult asyncResult);
85
86                 IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState);
87
88                 void EndWrite (IAsyncResult asyncResult);
89
90                 Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken);
91
92                 Task ShutdownAsync ();
93
94                 TransportContext TransportContext {
95                         get;
96                 }
97
98                 bool IsAuthenticated {
99                         get;
100                 }
101
102                 bool IsMutuallyAuthenticated {
103                         get;
104                 }
105
106                 bool IsEncrypted {
107                         get;
108                 }
109
110                 bool IsSigned {
111                         get;
112                 }
113
114                 bool IsServer {
115                         get;
116                 }
117
118                 SSA.CipherAlgorithmType CipherAlgorithm {
119                         get;
120                 }
121
122                 int CipherStrength {
123                         get;
124                 }
125
126                 SSA.HashAlgorithmType HashAlgorithm {
127                         get;
128                 }
129
130                 int HashStrength {
131                         get;
132                 }
133
134                 SSA.ExchangeAlgorithmType KeyExchangeAlgorithm {
135                         get;
136                 }
137
138                 int KeyExchangeStrength {
139                         get;
140                 }
141
142                 bool CanRead {
143                         get;
144                 }
145
146                 bool CanTimeout {
147                         get;
148                 }
149
150                 bool CanWrite {
151                         get;
152                 }
153
154                 long Length {
155                         get;
156                 }
157
158                 long Position {
159                         get;
160                 }
161
162                 void SetLength (long value);
163
164                 AuthenticatedStream AuthenticatedStream {
165                         get;
166                 }
167
168                 int ReadTimeout {
169                         get; set;
170                 }
171
172                 int WriteTimeout {
173                         get; set;
174                 }
175
176                 bool CheckCertRevocationStatus {
177                         get;
178                 }
179
180                 X509Certificate InternalLocalCertificate {
181                         get;
182                 }
183
184                 X509Certificate LocalCertificate {
185                         get;
186                 }
187
188                 X509Certificate RemoteCertificate {
189                         get;
190                 }
191
192                 SSA.SslProtocols SslProtocol {
193                         get;
194                 }
195
196                 MonoTlsProvider Provider {
197                         get;
198                 }
199
200
201                 MonoTlsConnectionInfo GetConnectionInfo ();
202         }
203 }
204