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

@ -59,7 +59,7 @@ namespace System.Security.Cryptography {
public const string Sha512 = "SHA512"; // BCRYPT_SHA512_ALGORITHM
internal const string Rsa = "RSA"; // BCRYPT_RSA_ALGORITHM
}
#if !MONO
/// <summary>
/// Well known key blob tyes
/// </summary>
@ -454,5 +454,6 @@ namespace System.Security.Cryptography {
}
return keyBlob;
}
#endif
}
}

View File

@ -31,6 +31,10 @@ namespace System.Security.Cryptography {
/// </summary>
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class CngKey : IDisposable {
#if MONO
public void Dispose() {
}
#else
private SafeNCryptKeyHandle m_keyHandle;
private SafeNCryptProviderHandle m_kspHandle;
@ -816,5 +820,6 @@ namespace System.Security.Cryptography {
Contract.Assert(m_keyHandle != null);
NCryptNative.SetProperty(m_keyHandle, property.Name, property.Value, property.Options);
}
#endif
}
}

View File

@ -18,6 +18,15 @@ namespace System.Security.Cryptography {
/// </summary>
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class ECDsaCng : ECDsa {
#if MONO
public override byte[] SignHash(byte[] hash) {
throw new NotImplementedException();
}
public override bool VerifyHash(byte[] hash, byte[] signature) {
throw new NotImplementedException();
}
#else
private static KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(256, 384, 128), new KeySizes(521, 521, 0) };
private CngKey m_key;
@ -407,5 +416,6 @@ namespace System.Security.Cryptography {
return hasher.HashFinal();
}
}
#endif
}
}

View File

@ -8,7 +8,9 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
#if !MONO
using System.Numerics;
#endif
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
@ -100,7 +102,7 @@ namespace System.Security.Cryptography {
ProtectKey = 0x00000001, // NCRYPT_UI_PROTECT_KEY_FLAG
ForceHighProtection = 0x00000002 // NCRYPT_UI_FORCE_HIGH_PROTECTION_FLAG
}
#if !MONO
/// <summary>
/// Native interop with CNG's NCrypt layer. Native definitions are in ncrypt.h
/// </summary>
@ -1741,4 +1743,5 @@ namespace System.Security.Cryptography {
return error == ErrorCode.Success;
}
}
#endif
}

View File

@ -10,6 +10,18 @@ namespace System.Security.Cryptography
{
public sealed class RSACng : RSA
{
#if MONO
public override RSAParameters ExportParameters(bool includePrivateParameters)
{
throw new NotImplementedException();
}
public override void ImportParameters(RSAParameters parameters)
{
throw new NotImplementedException();
}
#else
// See https://msdn.microsoft.com/en-us/library/windows/desktop/bb931354(v=vs.85).aspx
private static KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(512, 16384, 64) };
@ -504,5 +516,6 @@ namespace System.Security.Cryptography
throw new CryptographicException(SR.GetString(SR.Cryptography_UnsupportedPaddingMode));
}
}
#endif
}
}

View File

@ -42,10 +42,11 @@ namespace Microsoft.Win32.SafeHandles {
SetHandle(existingHandle);
}
#if !MONO
[DllImport(ExternDll.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Auto, SetLastError=true)]
[ResourceExposure(ResourceScope.Machine)]
internal static extern SafeProcessHandle OpenProcess(int access, bool inherit, int processId);
#endif
internal void InitialSetHandle(IntPtr h){
Debug.Assert(base.IsInvalid, "Safe handle should only be set once");
@ -54,7 +55,11 @@ namespace Microsoft.Win32.SafeHandles {
override protected bool ReleaseHandle()
{
#if !MONO
return SafeNativeMethods.CloseHandle(handle);
#else
return NativeMethods.CloseProcess (handle);
#endif
}
}