Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if SECURITY_DEP && !MONO_FEATURE_NEW_TLS
namespace System.Net.Security
{
public enum EncryptionPolicy
@@ -35,4 +34,3 @@ namespace System.Net.Security
NoEncryption
}
}
#endif

View File

@@ -28,7 +28,7 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if SECURITY_DEP && !MONO_FEATURE_NEW_TLS
#if SECURITY_DEP
using System.Security.Cryptography.X509Certificates;

View File

@@ -148,6 +148,12 @@ namespace System.Net.Security
throw new NotImplementedException ();
}
[MonoTODO]
public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, AsyncCallback asyncCallback, object asyncState)
{
throw new NotImplementedException ();
}
[MonoTODO]
public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, string targetName, AsyncCallback asyncCallback, object asyncState)
{
@@ -160,6 +166,12 @@ namespace System.Net.Security
throw new NotImplementedException ();
}
[MonoTODO]
public virtual IAsyncResult BeginAuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel, AsyncCallback asyncCallback, object asyncState)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
@@ -172,12 +184,24 @@ namespace System.Net.Security
throw new NotImplementedException ();
}
[MonoTODO]
public virtual IAsyncResult BeginAuthenticateAsServer (NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, object asyncState)
{
throw new NotImplementedException ();
}
[MonoTODO]
public virtual IAsyncResult BeginAuthenticateAsServer (NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel, AsyncCallback asyncCallback, object asyncState)
{
throw new NotImplementedException ();
}
[MonoTODO]
public virtual IAsyncResult BeginAuthenticateAsServer (ExtendedProtectionPolicy policy, AsyncCallback asyncCallback, object asyncState)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
@@ -196,6 +220,18 @@ namespace System.Net.Security
throw new NotImplementedException ();
}
[MonoTODO]
public virtual void AuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName)
{
throw new NotImplementedException ();
}
[MonoTODO]
public virtual void AuthenticateAsClient (NetworkCredential credential, ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
{
throw new NotImplementedException ();
}
[MonoTODO]
public virtual void AuthenticateAsClient (NetworkCredential credential, string targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
{
@@ -208,6 +244,18 @@ namespace System.Net.Security
throw new NotImplementedException ();
}
[MonoTODO]
public virtual void AuthenticateAsServer (ExtendedProtectionPolicy policy)
{
throw new NotImplementedException ();
}
[MonoTODO]
public virtual void AuthenticateAsServer (NetworkCredential credential, ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
{
throw new NotImplementedException ();
}
[MonoTODO]
public virtual void AuthenticateAsServer (NetworkCredential credential, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel requiredImpersonationLevel)
{

View File

@@ -28,8 +28,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MONO_FEATURE_NEW_TLS
using System.Security.Cryptography.X509Certificates;
namespace System.Net.Security
@@ -40,4 +38,3 @@ namespace System.Net.Security
X509Chain chain,
SslPolicyErrors sslPolicyErrors);
}
#endif

View File

@@ -25,7 +25,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if !MONO_FEATURE_NEW_TLS
namespace System.Net.Security
{
[Flags]
@@ -37,4 +36,3 @@ namespace System.Net.Security
RemoteCertificateChainErrors = 4,
}
}
#endif

View File

@@ -24,7 +24,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if !MONO_FEATURE_NEW_TLS
#if SECURITY_DEP
#if MONO_SECURITY_ALIAS
@@ -410,5 +409,3 @@ namespace System.Net.Security
}
}
#endif
#endif

View File

@@ -0,0 +1,287 @@
//
// SslStream.cs
//
// Author:
// Rolf Bjarne Kvinge <rolf@xamarin.com>
//
// Copyright (c) 2016 Xamarin, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.IO;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
namespace System.Net.Security
{
public class SslStream : AuthenticatedStream
{
const string EXCEPTION_MESSAGE = "System.Net.Security.SslStream is not supported on the current platform.";
public SslStream (Stream innerStream)
: this (innerStream, false, null, null)
{
}
public SslStream (Stream innerStream, bool leaveInnerStreamOpen)
: this (innerStream, leaveInnerStreamOpen, null, null)
{
}
public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback)
: this (innerStream, leaveInnerStreamOpen, userCertificateValidationCallback, null)
{
}
public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback)
: base (innerStream, leaveInnerStreamOpen)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback, EncryptionPolicy encryptionPolicy)
: this (innerStream, leaveInnerStreamOpen, userCertificateValidationCallback, userCertificateSelectionCallback)
{
}
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 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 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 PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override long Position {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
public override void SetLength (long value)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override long Seek (long offset, SeekOrigin origin)
{
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
public override void Flush ()
{
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);
}
}
}