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