SslStream.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. //
  2. // System.Net.Security.SslStream.cs
  3. //
  4. // Authors:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2004
  8. // (c) 2004 Novell, Inc. (http://www.novell.com)
  9. //
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. #if NET_2_0
  31. using System;
  32. using System.IO;
  33. using System.Net;
  34. using System.Security.Authentication;
  35. using System.Security.Cryptography.X509Certificates;
  36. using System.Security.Principal;
  37. namespace System.Net.Security
  38. {
  39. public class SslStream : AuthenticatedStream
  40. {
  41. #region Fields
  42. int readTimeout;
  43. int writeTimeout;
  44. #endregion // Fields
  45. #region Constructors
  46. [MonoTODO]
  47. public SslStream (Stream innerStream)
  48. : base (innerStream, false)
  49. {
  50. }
  51. [MonoTODO]
  52. public SslStream (Stream innerStream, bool leaveStreamOpen)
  53. : base (innerStream, leaveStreamOpen)
  54. {
  55. }
  56. [MonoTODO]
  57. public SslStream (Stream innerStream, bool leaveStreamOpen, RemoteCertificateValidationCallback certValidationCallback)
  58. : base (innerStream, leaveStreamOpen)
  59. {
  60. }
  61. [MonoTODO]
  62. public SslStream (Stream innerStream, bool leaveStreamOpen, RemoteCertificateValidationCallback certValidationCallback, LocalCertificateSelectionCallback certSelectionCallback)
  63. : base (innerStream, leaveStreamOpen)
  64. {
  65. }
  66. #endregion // Constructors
  67. #region Properties
  68. public override bool CanRead {
  69. get { return InnerStream.CanRead; }
  70. }
  71. public override bool CanSeek {
  72. get { return InnerStream.CanSeek; }
  73. }
  74. [MonoTODO]
  75. public override bool CanTimeout {
  76. get { throw new NotImplementedException (); }
  77. }
  78. public override bool CanWrite {
  79. get { return InnerStream.CanWrite; }
  80. }
  81. [MonoTODO]
  82. public virtual bool CheckCertRevocationStatus {
  83. get { throw new NotImplementedException (); }
  84. }
  85. [MonoTODO]
  86. public virtual CipherAlgorithmType CipherAlgorithm {
  87. get { throw new NotImplementedException (); }
  88. }
  89. [MonoTODO]
  90. public virtual int CipherStrength {
  91. get { throw new NotImplementedException (); }
  92. }
  93. [MonoTODO]
  94. public virtual HashAlgorithmType HashAlgorithm {
  95. get { throw new NotImplementedException (); }
  96. }
  97. [MonoTODO]
  98. public virtual int HashStrength {
  99. get { throw new NotImplementedException (); }
  100. }
  101. [MonoTODO]
  102. public virtual TokenImpersonationLevel ImpersonationLevel {
  103. get { throw new NotImplementedException (); }
  104. }
  105. [MonoTODO]
  106. public override bool IsAuthenticated {
  107. get { throw new NotImplementedException (); }
  108. }
  109. [MonoTODO]
  110. public override bool IsEncrypted {
  111. get { throw new NotImplementedException (); }
  112. }
  113. [MonoTODO]
  114. public override bool IsMutuallyAuthenticated {
  115. get { throw new NotImplementedException (); }
  116. }
  117. [MonoTODO]
  118. public override bool IsServer {
  119. get { throw new NotImplementedException (); }
  120. }
  121. [MonoTODO]
  122. public override bool IsSigned {
  123. get { throw new NotImplementedException (); }
  124. }
  125. [MonoTODO]
  126. public virtual ExchangeAlgorithmType KeyExchangeAlgorithm {
  127. get { throw new NotImplementedException (); }
  128. }
  129. [MonoTODO]
  130. public virtual int KeyExchangeStrength {
  131. get { throw new NotImplementedException (); }
  132. }
  133. public override long Length {
  134. get { return InnerStream.Length; }
  135. }
  136. [MonoTODO]
  137. public virtual X509Certificate LocalCertificate {
  138. get { throw new NotImplementedException (); }
  139. }
  140. public override long Position {
  141. get { return InnerStream.Position; }
  142. set { InnerStream.Position = value; }
  143. }
  144. public override int ReadTimeout {
  145. get { return readTimeout; }
  146. set { readTimeout = value; }
  147. }
  148. [MonoTODO]
  149. public virtual X509Certificate RemoteCertificate {
  150. get { throw new NotImplementedException (); }
  151. }
  152. [MonoTODO]
  153. public virtual SslProtocols SslProtocol {
  154. get { throw new NotImplementedException (); }
  155. }
  156. public override int WriteTimeout {
  157. get { return writeTimeout; }
  158. set { writeTimeout = value; }
  159. }
  160. #endregion // Properties
  161. #region Methods
  162. [MonoTODO]
  163. public virtual IAsyncResult BeginClientAuthenticate (string targetHost, AsyncCallback asyncCallback, object asyncState)
  164. {
  165. throw new NotImplementedException ();
  166. }
  167. [MonoTODO]
  168. public virtual IAsyncResult BeginClientAuthenticate (string targetHost, X509CertificateCollection clientCertificates, SslProtocols sslProtocolType, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
  169. {
  170. throw new NotImplementedException ();
  171. }
  172. [MonoTODO]
  173. public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
  174. {
  175. throw new NotImplementedException ();
  176. }
  177. [MonoTODO]
  178. public virtual IAsyncResult BeginServerAuthenticate (X509Certificate serverCertificate, AsyncCallback callback, object asyncState)
  179. {
  180. throw new NotImplementedException ();
  181. }
  182. [MonoTODO]
  183. public virtual IAsyncResult BeginServerAuthenticate (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols sslProtocolType, bool checkCertificateRevocation, AsyncCallback callback, object asyncState)
  184. {
  185. throw new NotImplementedException ();
  186. }
  187. [MonoTODO]
  188. public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
  189. {
  190. throw new NotImplementedException ();
  191. }
  192. [MonoTODO]
  193. public virtual void ClientAuthenticate ()
  194. {
  195. throw new NotImplementedException ();
  196. }
  197. [MonoTODO]
  198. public virtual void ClientAuthenticate (string targetHost)
  199. {
  200. throw new NotImplementedException ();
  201. }
  202. [MonoTODO]
  203. public virtual void ClientAuthenticate (string targetHost, X509CertificateCollection clientCertificates, SslProtocols sslProtocolType, bool checkCertificateRevocation)
  204. {
  205. throw new NotImplementedException ();
  206. }
  207. [MonoTODO]
  208. public override void Close ()
  209. {
  210. InnerStream.Close ();
  211. }
  212. [MonoTODO]
  213. public virtual void EndClientAuthenticate (IAsyncResult asyncResult)
  214. {
  215. throw new NotImplementedException ();
  216. }
  217. [MonoTODO]
  218. public override int EndRead (IAsyncResult asyncResult)
  219. {
  220. throw new NotImplementedException ();
  221. }
  222. [MonoTODO]
  223. public virtual void EndServerAuthenticate (IAsyncResult asyncResult)
  224. {
  225. throw new NotImplementedException ();
  226. }
  227. [MonoTODO]
  228. public override void EndWrite (IAsyncResult asyncResult)
  229. {
  230. throw new NotImplementedException ();
  231. }
  232. [MonoTODO]
  233. public override void Flush ()
  234. {
  235. InnerStream.Flush ();
  236. }
  237. [MonoTODO]
  238. public override int Read (byte[] buffer, int offset, int count)
  239. {
  240. throw new NotImplementedException ();
  241. }
  242. [MonoTODO]
  243. public override long Seek (long offset, SeekOrigin origin)
  244. {
  245. throw new NotImplementedException ();
  246. }
  247. [MonoTODO]
  248. public override void SetLength (long value)
  249. {
  250. throw new NotImplementedException ();
  251. }
  252. [MonoTODO]
  253. public override void Write (byte[] buffer, int offset, int count)
  254. {
  255. throw new NotImplementedException ();
  256. }
  257. public void Write (byte[] buffer)
  258. {
  259. Write (buffer, 0, buffer.Length);
  260. }
  261. #endregion // Methods
  262. }
  263. }
  264. #endif