Imported Upstream version 4.4.2.4

Former-commit-id: 92904c9c5915c37244316e42ba99e7b934ed7ee2
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-07-21 09:40:10 +00:00
parent 589d484eee
commit 0b4a830db1
343 changed files with 9849 additions and 688 deletions

View File

@ -0,0 +1,49 @@
//
// SafeNCryptHandle.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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;
namespace Microsoft.Win32.SafeHandles
{
public abstract class SafeNCryptHandle : System.Runtime.InteropServices.SafeHandle
{
protected SafeNCryptHandle ()
: base (IntPtr.Zero, true)
{
}
public override bool IsInvalid { get { throw new NotImplementedException (); } }
protected override bool ReleaseHandle ()
{
return false;
}
protected abstract bool ReleaseNativeHandle();
}
}

View File

@ -0,0 +1,42 @@
//
// SafeNCryptKeyHandle.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeNCryptKeyHandle : SafeNCryptHandle
{
public SafeNCryptKeyHandle ()
{
}
protected override bool ReleaseNativeHandle ()
{
return false;
}
}
}

View File

@ -0,0 +1,42 @@
//
// SafeNCryptProviderHandle.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeNCryptProviderHandle : SafeNCryptHandle
{
public SafeNCryptProviderHandle ()
{
}
protected override bool ReleaseNativeHandle ()
{
return false;
}
}
}

View File

@ -0,0 +1,42 @@
//
// SafeNCryptSecretHandle.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeNCryptSecretHandle : SafeNCryptHandle
{
public SafeNCryptSecretHandle ()
{
}
protected override bool ReleaseNativeHandle ()
{
return false;
}
}
}

View File

@ -63,7 +63,7 @@ namespace System.IO.Pipes
{
}
public AnonymousPipeClientStream (PipeDirection direction,SafePipeHandle safePipeHandle)
public AnonymousPipeClientStream (PipeDirection direction, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
{
/*
@ -73,7 +73,11 @@ namespace System.IO.Pipes
impl = new UnixAnonymousPipeClient (this, safePipeHandle);
*/
#if MOBILE
throw new NotImplementedException ();
#else
InitializeHandle (safePipeHandle, false, false);
#endif
IsConnected = true;
}

View File

@ -59,10 +59,18 @@ namespace System.IO.Pipes
}
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize)
#if MOBILE
: base (direction, bufferSize)
{
throw new NotImplementedException ();
}
#else
: this (direction, inheritability, bufferSize, null)
{
}
#endif
#if !MOBILE
public AnonymousPipeServerStream (PipeDirection direction, HandleInheritability inheritability, int bufferSize, PipeSecurity pipeSecurity)
: base (direction, bufferSize)
{
@ -77,6 +85,7 @@ namespace System.IO.Pipes
InitializeHandle (impl.Handle, false, false);
IsConnected = true;
}
#endif
[MonoTODO]
public AnonymousPipeServerStream (PipeDirection direction, SafePipeHandle serverSafePipeHandle, SafePipeHandle clientSafePipeHandle)
@ -90,6 +99,9 @@ namespace System.IO.Pipes
if (direction == PipeDirection.InOut)
throw new NotSupportedException ("Anonymous pipe direction can only be either in or out.");
#if MOBILE
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32AnonymousPipeServer (this, serverSafePipeHandle, clientSafePipeHandle);
else
@ -99,6 +111,12 @@ namespace System.IO.Pipes
IsConnected = true;
ClientSafePipeHandle = clientSafePipeHandle;
#endif
}
~AnonymousPipeServerStream ()
{
// To be compatible with .net
}
IAnonymousPipeServer impl;

View File

@ -72,21 +72,33 @@ namespace System.IO.Pipes
}
public NamedPipeClientStream (string serverName, string pipeName, PipeDirection direction, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
#if MOBILE
: base (direction, DefaultBufferSize)
{
throw new NotImplementedException ();
}
#else
: this (serverName, pipeName, ToAccessRights (direction), options, impersonationLevel, inheritability)
{
}
#endif
public NamedPipeClientStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
{
#if MOBILE
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32NamedPipeClient (this, safePipeHandle);
else
impl = new UnixNamedPipeClient (this, safePipeHandle);
IsConnected = isConnected;
InitializeHandle (safePipeHandle, true, isAsync);
#endif
}
#if !MOBILE
public NamedPipeClientStream (string serverName, string pipeName, PipeAccessRights desiredAccessRights, PipeOptions options, TokenImpersonationLevel impersonationLevel, HandleInheritability inheritability)
: base (ToDirection (desiredAccessRights), DefaultBufferSize)
{
@ -99,21 +111,30 @@ namespace System.IO.Pipes
else
impl = new UnixNamedPipeClient (this, serverName, pipeName, desiredAccessRights, options, inheritability);
}
#endif
INamedPipeClient impl;
public void Connect ()
{
#if MOBILE
throw new NotImplementedException ();
#else
impl.Connect ();
InitializeHandle (impl.Handle, false, impl.IsAsync);
IsConnected = true;
#endif
}
public void Connect (int timeout)
{
#if MOBILE
throw new NotImplementedException ();
#else
impl.Connect (timeout);
InitializeHandle (impl.Handle, false, impl.IsAsync);
IsConnected = true;
#endif
}
public int NumberOfServerInstances {

View File

@ -70,10 +70,18 @@ namespace System.IO.Pipes
}
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize)
#if MOBILE
: base (direction, inBufferSize)
{
throw new NotImplementedException ();
}
#else
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, null)
{
}
#endif
#if !MOBILE
public NamedPipeServerStream (string pipeName, PipeDirection direction, int maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, int inBufferSize, int outBufferSize, PipeSecurity pipeSecurity)
: this (pipeName, direction, maxNumberOfServerInstances, transmissionMode, options, inBufferSize, outBufferSize, pipeSecurity, HandleInheritability.None)
{
@ -101,16 +109,26 @@ namespace System.IO.Pipes
InitializeHandle (impl.Handle, false, (options & PipeOptions.Asynchronous) != PipeOptions.None);
}
#endif
public NamedPipeServerStream (PipeDirection direction, bool isAsync, bool isConnected, SafePipeHandle safePipeHandle)
: base (direction, DefaultBufferSize)
{
#if MOBILE
throw new NotImplementedException ();
#else
if (IsWindows)
impl = new Win32NamedPipeServer (this, safePipeHandle);
else
impl = new UnixNamedPipeServer (this, safePipeHandle);
IsConnected = isConnected;
InitializeHandle (safePipeHandle, true, isAsync);
#endif
}
~NamedPipeServerStream ()
{
// To be compatible with .net
}
INamedPipeServer impl;
@ -120,12 +138,14 @@ namespace System.IO.Pipes
impl.Disconnect ();
}
#if !MOBILE
[MonoTODO]
[SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlPrincipal)]
public void RunAsClient (PipeStreamImpersonationWorker impersonationWorker)
{
throw new NotImplementedException ();
}
#endif
public void WaitForConnection ()
{
@ -140,6 +160,7 @@ namespace System.IO.Pipes
throw new NotImplementedException ();
}
#if !MOBILE
// async operations
Action wait_connect_delegate;
@ -156,6 +177,7 @@ namespace System.IO.Pipes
{
wait_connect_delegate.EndInvoke (asyncResult);
}
#endif
}
}

View File

@ -46,15 +46,18 @@ namespace System.IO.Pipes
// FIXME: not precise.
internal const int DefaultBufferSize = 0x400;
#if !MOBILE
internal static bool IsWindows {
get { return Win32Marshal.IsWindows; }
}
#endif
internal Exception ThrowACLException ()
{
return new NotImplementedException ("ACL is not supported in Mono");
}
#if !MOBILE
internal static PipeAccessRights ToAccessRights (PipeDirection direction)
{
switch (direction) {
@ -85,6 +88,7 @@ namespace System.IO.Pipes
throw new ArgumentOutOfRangeException ();
}
}
#endif
protected PipeStream (PipeDirection direction, int bufferSize)
: this (direction, PipeTransmissionMode.Byte, bufferSize)
@ -140,7 +144,9 @@ namespace System.IO.Pipes
set { stream = value; }
}
#if !MOBILE
protected bool IsHandleExposed { get; private set; }
#endif
[MonoTODO]
public bool IsMessageComplete { get; private set; }
@ -176,7 +182,19 @@ namespace System.IO.Pipes
}
// initialize/dispose/state check
#if MOBILE
internal static void CheckPipePropertyOperations ()
{
}
static void CheckReadOperations ()
{
}
static void CheckWriteOperations ()
{
}
#else
[MonoTODO]
protected internal virtual void CheckPipePropertyOperations ()
{
@ -206,6 +224,7 @@ namespace System.IO.Pipes
this.IsHandleExposed = isExposed;
this.IsAsync = isAsync;
}
#endif
protected override void Dispose (bool disposing)
{
@ -234,6 +253,7 @@ namespace System.IO.Pipes
throw new NotSupportedException ();
}
#if !MOBILE
public PipeSecurity GetAccessControl ()
{
return new PipeSecurity (SafePipeHandle,
@ -255,6 +275,7 @@ namespace System.IO.Pipes
public void WaitForPipeDrain ()
{
}
#endif
[MonoTODO]
public override int Read ([In] byte [] buffer, int offset, int count)
@ -298,6 +319,7 @@ namespace System.IO.Pipes
// async
#if !MOBILE
Func<byte [],int,int,int> read_delegate;
[HostProtection (SecurityAction.LinkDemand, ExternalThreading = true)]
@ -327,6 +349,7 @@ namespace System.IO.Pipes
{
write_delegate.EndInvoke (asyncResult);
}
#endif
}
}

View File

@ -0,0 +1,45 @@
//
// ECDsaCertificateExtensions.cs
//
// Authors:
// Alexander Köplinger <alexander.koeplinger@xamarin.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
namespace System.Security.Cryptography.X509Certificates
{
public static class ECDsaCertificateExtensions
{
[MonoTODO]
public static ECDsa GetECDsaPrivateKey (this X509Certificate2 certificate)
{
throw new NotImplementedException ();
}
[MonoTODO]
public static ECDsa GetECDsaPublicKey (this X509Certificate2 certificate)
{
throw new NotImplementedException ();
}
}
}

View File

@ -0,0 +1,45 @@
//
// RsaCertificateExtensions.cs
//
// Authors:
// Alexander Köplinger <alexander.koeplinger@xamarin.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
namespace System.Security.Cryptography.X509Certificates
{
public static class RSACertificateExtensions
{
[MonoTODO]
public static RSA GetRSAPrivateKey(this X509Certificate2 certificate)
{
throw new NotImplementedException ();
}
[MonoTODO]
public static RSA GetRSAPublicKey(this X509Certificate2 certificate)
{
throw new NotImplementedException ();
}
}
}

View File

@ -0,0 +1,104 @@
//
// AesCng.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
namespace System.Security.Cryptography
{
public sealed class AesCng : Aes
{
public AesCng ()
{
throw new NotImplementedException ();
}
public AesCng (string keyName)
{
throw new NotImplementedException ();
}
public AesCng (string keyName, CngProvider provider)
{
throw new NotImplementedException ();
}
public AesCng (string keyName, CngProvider provider, CngKeyOpenOptions openOptions)
{
throw new NotImplementedException ();
}
public override Byte[] Key {
get {
throw new NotImplementedException ();
} set {
throw new NotImplementedException ();
}
}
public override int KeySize {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
public override ICryptoTransform CreateDecryptor ()
{
throw new NotImplementedException ();
}
public override ICryptoTransform CreateDecryptor (Byte[] rgbKey, Byte[] rgbIV)
{
throw new NotImplementedException ();
}
public override ICryptoTransform CreateEncryptor ()
{
throw new NotImplementedException ();
}
public override ICryptoTransform CreateEncryptor (Byte[] rgbKey, Byte[] rgbIV)
{
return default(System.Security.Cryptography.ICryptoTransform);
}
protected override void Dispose (bool disposing) {
throw new NotImplementedException ();
}
public override void GenerateIV ()
{
throw new NotImplementedException ();
}
public override void GenerateKey ()
{
throw new NotImplementedException ();
}
}
}

View File

@ -1,192 +0,0 @@
//
// System.Security.Cryptography.CngAlgorithm
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// 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;
namespace System.Security.Cryptography {
// note: CNG stands for "Cryptography API: Next Generation"
[Serializable]
public sealed class CngAlgorithm : IEquatable<CngAlgorithm> {
private string m_algorithm;
public CngAlgorithm (string algorithm)
{
if (algorithm == null)
throw new ArgumentNullException ("algorithm");
if (algorithm.Length == 0)
throw new ArgumentException ("algorithm");
m_algorithm = algorithm;
}
public string Algorithm {
get { return m_algorithm; }
}
public bool Equals (CngAlgorithm other)
{
if (other == null)
return false;
return m_algorithm == other.m_algorithm;
}
public override bool Equals (object obj)
{
return Equals (obj as CngAlgorithm);
}
public override int GetHashCode ()
{
return m_algorithm.GetHashCode ();
}
public override string ToString ()
{
return m_algorithm;
}
// static
static CngAlgorithm dh256;
static CngAlgorithm dh384;
static CngAlgorithm dh521;
static CngAlgorithm dsa256;
static CngAlgorithm dsa384;
static CngAlgorithm dsa521;
static CngAlgorithm md5;
static CngAlgorithm sha1;
static CngAlgorithm sha256;
static CngAlgorithm sha384;
static CngAlgorithm sha512;
public static CngAlgorithm ECDiffieHellmanP256 {
get {
if (dh256 == null)
dh256 = new CngAlgorithm ("ECDH_P256");
return dh256;
}
}
public static CngAlgorithm ECDiffieHellmanP384 {
get {
if (dh384 == null)
dh384 = new CngAlgorithm ("ECDH_P384");
return dh384;
}
}
public static CngAlgorithm ECDiffieHellmanP521 {
get {
if (dh521 == null)
dh521 = new CngAlgorithm ("ECDH_P521");
return dh521;
}
}
public static CngAlgorithm ECDsaP256 {
get {
if (dsa256 == null)
dsa256 = new CngAlgorithm ("ECDSA_P256");
return dsa256;
}
}
public static CngAlgorithm ECDsaP384 {
get {
if (dsa384 == null)
dsa384 = new CngAlgorithm ("ECDSA_P384");
return dsa384;
}
}
public static CngAlgorithm ECDsaP521 {
get {
if (dsa521 == null)
dsa521 = new CngAlgorithm ("ECDSA_P521");
return dsa521;
}
}
public static CngAlgorithm MD5 {
get {
if (md5 == null)
md5 = new CngAlgorithm ("MD5");
return md5;
}
}
public static CngAlgorithm Sha1 {
get {
if (sha1 == null)
sha1 = new CngAlgorithm ("SHA1");
return sha1;
}
}
public static CngAlgorithm Sha256 {
get {
if (sha256 == null)
sha256 = new CngAlgorithm ("SHA256");
return sha256;
}
}
public static CngAlgorithm Sha384 {
get {
if (sha384 == null)
sha384 = new CngAlgorithm ("SHA384");
return sha384;
}
}
public static CngAlgorithm Sha512 {
get {
if (sha512 == null)
sha512 = new CngAlgorithm ("SHA512");
return sha512;
}
}
public static bool operator == (CngAlgorithm left, CngAlgorithm right)
{
if ((object)left == null)
return ((object)right == null);
return left.Equals (right);
}
public static bool operator != (CngAlgorithm left, CngAlgorithm right)
{
if ((object)left == null)
return ((object)right != null);
return !left.Equals (right);
}
}
}

View File

@ -1,138 +0,0 @@
//
// System.Security.Cryptography.CngAlgorithmGroup
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
//
// 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;
namespace System.Security.Cryptography {
// note: CNG stands for "Cryptography API: Next Generation"
[Serializable]
public sealed class CngAlgorithmGroup : IEquatable<CngAlgorithmGroup> {
private string m_algorithmGroup;
public CngAlgorithmGroup (string algorithmGroup)
{
if (algorithmGroup == null)
throw new ArgumentNullException ("algorithmGroup");
if (algorithmGroup.Length == 0)
throw new ArgumentException ("algorithmGroup");
m_algorithmGroup = algorithmGroup;
}
public string AlgorithmGroup {
get { return m_algorithmGroup; }
}
public bool Equals (CngAlgorithmGroup other)
{
if (other == null)
return false;
return m_algorithmGroup == other.m_algorithmGroup;
}
public override bool Equals (object obj)
{
return Equals (obj as CngAlgorithmGroup);
}
public override int GetHashCode ()
{
return m_algorithmGroup.GetHashCode ();
}
public override string ToString ()
{
return m_algorithmGroup;
}
// static
private static CngAlgorithmGroup dh;
private static CngAlgorithmGroup dsa;
private static CngAlgorithmGroup ecdh;
private static CngAlgorithmGroup ecdsa;
private static CngAlgorithmGroup rsa;
public static CngAlgorithmGroup DiffieHellman {
get {
if (dh == null)
dh = new CngAlgorithmGroup ("DH");
return dh;
}
}
public static CngAlgorithmGroup Dsa {
get {
if (dsa == null)
dsa = new CngAlgorithmGroup ("DSA");
return dsa;
}
}
public static CngAlgorithmGroup ECDiffieHellman {
get {
if (ecdh == null)
ecdh = new CngAlgorithmGroup ("ECDH");
return ecdh;
}
}
public static CngAlgorithmGroup ECDsa {
get {
if (ecdsa == null)
ecdsa = new CngAlgorithmGroup ("ECDSA");
return ecdsa;
}
}
public static CngAlgorithmGroup Rsa {
get {
if (rsa == null)
rsa = new CngAlgorithmGroup ("RSA");
return rsa;
}
}
public static bool operator == (CngAlgorithmGroup left, CngAlgorithmGroup right)
{
if ((object)left == null)
return ((object)right == null);
return left.Equals (right);
}
public static bool operator != (CngAlgorithmGroup left, CngAlgorithmGroup right)
{
if ((object)left == null)
return ((object)right != null);
return !left.Equals (right);
}
}
}

View File

@ -0,0 +1,104 @@
//
// TripleDESCng.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
namespace System.Security.Cryptography
{
public sealed class TripleDESCng : TripleDES
{
public TripleDESCng ()
{
throw new NotImplementedException ();
}
public TripleDESCng (string keyName)
{
throw new NotImplementedException ();
}
public TripleDESCng (string keyName, CngProvider provider)
{
throw new NotImplementedException ();
}
public TripleDESCng (string keyName, CngProvider provider, CngKeyOpenOptions openOptions)
{
throw new NotImplementedException ();
}
public override Byte[] Key {
get {
throw new NotImplementedException ();
} set {
throw new NotImplementedException ();
}
}
public override int KeySize {
get {
throw new NotImplementedException ();
}
set {
throw new NotImplementedException ();
}
}
public override ICryptoTransform CreateDecryptor ()
{
throw new NotImplementedException ();
}
public override ICryptoTransform CreateDecryptor (Byte[] rgbKey, Byte[] rgbIV)
{
throw new NotImplementedException ();
}
public override ICryptoTransform CreateEncryptor ()
{
throw new NotImplementedException ();
}
public override ICryptoTransform CreateEncryptor (Byte[] rgbKey, Byte[] rgbIV)
{
return default(System.Security.Cryptography.ICryptoTransform);
}
protected override void Dispose (bool disposing) {
throw new NotImplementedException ();
}
public override void GenerateIV ()
{
throw new NotImplementedException ();
}
public override void GenerateKey ()
{
throw new NotImplementedException ();
}
}
}

View File

@ -6,6 +6,25 @@ System.IO.MemoryMappedFiles/MemoryMappedFile.cs
System.IO.MemoryMappedFiles/MemoryMappedView.cs
Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
System.Security.Cryptography/AesCng.cs
System.Security.Cryptography/TripleDESCng.cs
System.Security.Cryptography.X509Certificates/ECDsaCertificateExtensions.cs
System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs
Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs
Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs
Microsoft.Win32.SafeHandles/SafeNCryptProviderHandle.cs
Microsoft.Win32.SafeHandles/SafeNCryptSecretHandle.cs
Microsoft.Win32.SafeHandles/SafePipeHandle.cs
System.IO.Pipes/AnonymousPipeClientStream.cs
System.IO.Pipes/AnonymousPipeServerStream.cs
System.IO.Pipes/NamedPipeClientStream.cs
System.IO.Pipes/NamedPipeServerStream.cs
System.IO.Pipes/PipeDirection.cs
System.IO.Pipes/PipeInterfaces.cs
System.IO.Pipes/PipeOptions.cs
System.IO.Pipes/PipeStream.cs
System.IO.Pipes/PipeTransmissionMode.cs
ReferenceSources/SR.cs
ReferenceSources/Error.cs
@ -184,8 +203,20 @@ ReferenceSources/Strings.cs
../../../external/referencesource/System.Core/System/Runtime/CompilerServices/ExecutionScope.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/Aes.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/BCryptNative.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngAlgorithm.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngAlgorithmGroup.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngKey.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngKeyBlobFormat.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngKeyCreationParameters.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngProperty.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngProvider.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/CngUIPolicy.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/ECDsa.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/ECDsaCng.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/NCryptNative.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/RsaCng.cs
../../../external/referencesource/System.Core/System/threading/ReaderWriterLockSlim/ReaderWriterLockSlim.cs

View File

@ -1,2 +1,17 @@
#include common_System.Core.dll.sources
#include interpreter_System.Core.dll.sources
System.Security.Cryptography/AesCryptoServiceProvider.cs
System.Security.Cryptography/AesTransform.cs
System.Security.Cryptography/MD5Cng.cs
System.Security.Cryptography/SHA1Cng.cs
System.Security.Cryptography/SHA256Cng.cs
System.Security.Cryptography/SHA256CryptoServiceProvider.cs
System.Security.Cryptography/SHA384Cng.cs
System.Security.Cryptography/SHA384CryptoServiceProvider.cs
System.Security.Cryptography/SHA512Cng.cs
System.Security.Cryptography/SHA512CryptoServiceProvider.cs
../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs
../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs
../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs

View File

@ -1,29 +1,16 @@
#include common_System.Core.dll.sources
#include dynamic_System.Core.dll.sources
Microsoft.Win32.SafeHandles/SafePipeHandle.cs
System.IO.Pipes/AnonymousPipeClientStream.cs
System.IO.Pipes/AnonymousPipeServerStream.cs
System.IO.Pipes/NamedPipeClientStream.cs
System.IO.Pipes/NamedPipeServerStream.cs
System.IO.Pipes/PipeAccessRights.cs
System.IO.Pipes/PipeAccessRule.cs
System.IO.Pipes/PipeAuditRule.cs
System.IO.Pipes/PipeDirection.cs
System.IO.Pipes/PipeInterfaces.cs
System.IO.Pipes/PipeOptions.cs
System.IO.Pipes/PipeSecurity.cs
System.IO.Pipes/PipeStream.cs
System.IO.Pipes/PipeStreamImpersonationWorker.cs
System.IO.Pipes/PipeTransmissionMode.cs
System.IO.Pipes/PipeUnix.cs
System.IO.Pipes/PipeWin32.cs
System.Security.Cryptography/AesCryptoServiceProvider.cs
System.Security.Cryptography/AesTransform.cs
System.Security.Cryptography/CngAlgorithm.cs
System.Security.Cryptography/CngAlgorithmGroup.cs
System.Security.Cryptography/MD5Cng.cs
System.Security.Cryptography/SHA1Cng.cs
System.Security.Cryptography/SHA256Cng.cs