You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@ -39,6 +39,7 @@ using Mono.Security.Interface;
|
||||
using CipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
|
||||
using HashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
|
||||
using ExchangeAlgorithmType = System.Security.Authentication.ExchangeAlgorithmType;
|
||||
#endif
|
||||
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
@ -71,8 +72,9 @@ namespace System.Net.Security
|
||||
X509Certificate remoteCertificate,
|
||||
string[] acceptableIssuers);
|
||||
|
||||
public class SslStream : AuthenticatedStream, MNS.IMonoSslStream
|
||||
public class SslStream : AuthenticatedStream
|
||||
{
|
||||
#if SECURITY_DEP
|
||||
MonoTlsProvider provider;
|
||||
IMonoSslStream impl;
|
||||
|
||||
@ -104,7 +106,7 @@ namespace System.Net.Security
|
||||
: base (innerStream, leaveInnerStreamOpen)
|
||||
{
|
||||
provider = GetProvider ();
|
||||
impl = provider.CreateSslStream (innerStream, leaveInnerStreamOpen);
|
||||
impl = provider.CreateSslStreamInternal (this, innerStream, leaveInnerStreamOpen, null);
|
||||
}
|
||||
|
||||
public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback)
|
||||
@ -128,10 +130,17 @@ namespace System.Net.Security
|
||||
{
|
||||
}
|
||||
|
||||
internal SslStream (Stream innerStream, bool leaveInnerStreamOpen, IMonoSslStream impl)
|
||||
internal SslStream (Stream innerStream, bool leaveInnerStreamOpen, MonoTlsProvider provider, MonoTlsSettings settings)
|
||||
: base (innerStream, leaveInnerStreamOpen)
|
||||
{
|
||||
this.impl = impl;
|
||||
this.provider = provider;
|
||||
impl = provider.CreateSslStreamInternal (this, innerStream, leaveInnerStreamOpen, settings);
|
||||
}
|
||||
|
||||
internal static IMonoSslStream CreateMonoSslStream (Stream innerStream, bool leaveInnerStreamOpen, MonoTlsProvider provider, MonoTlsSettings settings)
|
||||
{
|
||||
var sslStream = new SslStream (innerStream, leaveInnerStreamOpen, provider, settings);
|
||||
return sslStream.Impl;
|
||||
}
|
||||
|
||||
public virtual void AuthenticateAsClient (string targetHost)
|
||||
@ -214,6 +223,11 @@ namespace System.Net.Security
|
||||
return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
|
||||
}
|
||||
|
||||
public virtual Task ShutdownAsync ()
|
||||
{
|
||||
return Impl.ShutdownAsync ();
|
||||
}
|
||||
|
||||
public override bool IsAuthenticated {
|
||||
get { return Impl.IsAuthenticated; }
|
||||
}
|
||||
@ -242,10 +256,6 @@ namespace System.Net.Security
|
||||
get { return Impl.CheckCertRevocationStatus; }
|
||||
}
|
||||
|
||||
X509Certificate MNS.IMonoSslStream.InternalLocalCertificate {
|
||||
get { return Impl.InternalLocalCertificate; }
|
||||
}
|
||||
|
||||
public virtual X509Certificate LocalCertificate {
|
||||
get { return Impl.LocalCertificate; }
|
||||
}
|
||||
@ -384,97 +394,257 @@ namespace System.Net.Security
|
||||
{
|
||||
Impl.EndWrite (asyncResult);
|
||||
}
|
||||
|
||||
AuthenticatedStream MNS.IMonoSslStream.AuthenticatedStream {
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
MonoTlsProvider MNS.IMonoSslStream.Provider {
|
||||
get { return provider; }
|
||||
}
|
||||
|
||||
MonoTlsConnectionInfo MNS.IMonoSslStream.GetConnectionInfo ()
|
||||
{
|
||||
return Impl.GetConnectionInfo ();
|
||||
}
|
||||
}
|
||||
}
|
||||
#else // !SECURITY_DEP
|
||||
const string EXCEPTION_MESSAGE = "System.Net.Security.SslStream is not supported on the current platform.";
|
||||
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Net.Security
|
||||
{
|
||||
public class SslStream : Stream
|
||||
{
|
||||
public SslStream (object innerStream)
|
||||
public SslStream (Stream innerStream)
|
||||
: this (innerStream, false)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool CanRead {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
public SslStream (Stream innerStream, bool leaveInnerStreamOpen)
|
||||
: base (innerStream, leaveInnerStreamOpen)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback)
|
||||
: this (innerStream, leaveInnerStreamOpen)
|
||||
{
|
||||
}
|
||||
|
||||
public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback)
|
||||
: this (innerStream, leaveInnerStreamOpen)
|
||||
{
|
||||
}
|
||||
|
||||
public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback, EncryptionPolicy encryptionPolicy)
|
||||
: this (innerStream, leaveInnerStreamOpen)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void AuthenticateAsClient (string targetHost)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual void EndAuthenticateAsClient (IAsyncResult asyncResult)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual void AuthenticateAsServer (X509Certificate serverCertificate)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual void EndAuthenticateAsServer (IAsyncResult asyncResult)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public TransportContext TransportContext {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual Task AuthenticateAsClientAsync (string targetHost)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public override bool IsAuthenticated {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool IsMutuallyAuthenticated {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool IsSigned {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool IsServer {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual SslProtocols SslProtocol {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual bool CheckCertRevocationStatus {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual X509Certificate LocalCertificate {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual X509Certificate RemoteCertificate {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual CipherAlgorithmType CipherAlgorithm {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual int CipherStrength {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual HashAlgorithmType HashAlgorithm {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual int HashStrength {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual ExchangeAlgorithmType KeyExchangeAlgorithm {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public virtual int KeyExchangeStrength {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool CanSeek {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool CanRead {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool CanTimeout {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override bool CanWrite {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override int ReadTimeout {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override int WriteTimeout {
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override long Length {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override long Position {
|
||||
get {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Flush ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public override int Read (System.Byte [] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public override long Seek (long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
|
||||
}
|
||||
|
||||
public override void SetLength (long value)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public override void Write (System.Byte [] buffer, int offset, int count)
|
||||
public override long Seek (long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public virtual Task AuthenticateAsClientAsync (string targetHost, object clientCertificates, object enabledSslProtocols, bool checkCertificateRevocation)
|
||||
public override void Flush ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
public override int Read (byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public void Write (byte[] buffer)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public override void Write (byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public override int EndRead (IAsyncResult asyncResult)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
|
||||
public override void EndWrite (IAsyncResult asyncResult)
|
||||
{
|
||||
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user