Imported Upstream version 5.10.0.69

Former-commit-id: fc39669a0b707dd3c063977486506b6793da2890
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-29 19:03:06 +00:00
parent d8f8abd549
commit e2950ec768
6283 changed files with 453847 additions and 91879 deletions

View File

@ -5,7 +5,6 @@
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Security.Cryptography
{
public abstract partial class Aes : System.Security.Cryptography.SymmetricAlgorithm
@ -18,8 +17,8 @@ namespace System.Security.Cryptography
public sealed partial class AesManaged : System.Security.Cryptography.Aes
{
public AesManaged() { }
public override int FeedbackSize { get { throw null; } set { } }
public override int BlockSize { get { throw null; } set { } }
public override int FeedbackSize { get { throw null; } set { } }
public override byte[] IV { get { throw null; } set { } }
public override byte[] Key { get { throw null; } set { } }
public override int KeySize { get { throw null; } set { } }
@ -66,14 +65,6 @@ namespace System.Security.Cryptography
public abstract void SetHashAlgorithm(string strName);
public abstract void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key);
}
public abstract partial class DeriveBytes : System.IDisposable
{
protected DeriveBytes() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public abstract byte[] GetBytes(int cb);
public abstract void Reset();
}
public partial class CryptoConfig
{
public CryptoConfig() { }
@ -85,6 +76,14 @@ namespace System.Security.Cryptography
public static byte[] EncodeOID(string str) { throw null; }
public static string MapNameToOID(string name) { throw null; }
}
public abstract partial class DeriveBytes : System.IDisposable
{
protected DeriveBytes() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public abstract byte[] GetBytes(int cb);
public abstract void Reset();
}
[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
public abstract partial class DES : System.Security.Cryptography.SymmetricAlgorithm
{
@ -117,7 +116,6 @@ namespace System.Security.Cryptography
public virtual bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; }
public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature);
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct DSAParameters
{
public int Counter;
@ -145,9 +143,9 @@ namespace System.Security.Cryptography
public override void SetHashAlgorithm(string strName) { }
public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct ECCurve
{
private object _dummy;
public byte[] A;
public byte[] B;
public byte[] Cofactor;
@ -231,7 +229,6 @@ namespace System.Security.Cryptography
public bool VerifyData(System.IO.Stream data, byte[] signature, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; }
public abstract bool VerifyHash(byte[] hash, byte[] signature);
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct ECParameters
{
public System.Security.Cryptography.ECCurve Curve;
@ -239,7 +236,6 @@ namespace System.Security.Cryptography
public System.Security.Cryptography.ECPoint Q;
public void Validate() { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct ECPoint
{
public byte[] X;
@ -252,8 +248,10 @@ namespace System.Security.Cryptography
public override byte[] Key { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
protected override void HashCore(byte[] rgb, int ib, int cb) { }
protected override void HashCore(System.ReadOnlySpan<byte> source) { }
protected override byte[] HashFinal() { throw null; }
public override void Initialize() { }
protected override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public partial class HMACSHA1 : System.Security.Cryptography.HMAC
{
@ -264,8 +262,10 @@ namespace System.Security.Cryptography
public override byte[] Key { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
protected override void HashCore(byte[] rgb, int ib, int cb) { }
protected override void HashCore(System.ReadOnlySpan<byte> source) { }
protected override byte[] HashFinal() { throw null; }
public override void Initialize() { }
protected override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public partial class HMACSHA256 : System.Security.Cryptography.HMAC
{
@ -274,30 +274,36 @@ namespace System.Security.Cryptography
public override byte[] Key { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
protected override void HashCore(byte[] rgb, int ib, int cb) { }
protected override void HashCore(System.ReadOnlySpan<byte> source) { }
protected override byte[] HashFinal() { throw null; }
public override void Initialize() { }
protected override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public partial class HMACSHA384 : System.Security.Cryptography.HMAC
{
public HMACSHA384() { }
public HMACSHA384(byte[] key) { }
public bool ProduceLegacyHmacValues { get; set; }
public override byte[] Key { get { throw null; } set { } }
public bool ProduceLegacyHmacValues { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
protected override void HashCore(byte[] rgb, int ib, int cb) { }
protected override void HashCore(System.ReadOnlySpan<byte> source) { }
protected override byte[] HashFinal() { throw null; }
public override void Initialize() { }
protected override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public partial class HMACSHA512 : System.Security.Cryptography.HMAC
{
public HMACSHA512() { }
public HMACSHA512(byte[] key) { }
public bool ProduceLegacyHmacValues { get; set; }
public override byte[] Key { get { throw null; } set { } }
public bool ProduceLegacyHmacValues { get { throw null; } set { } }
protected override void Dispose(bool disposing) { }
protected override void HashCore(byte[] rgb, int ib, int cb) { }
protected override void HashCore(System.ReadOnlySpan<byte> source) { }
protected override byte[] HashFinal() { throw null; }
public override void Initialize() { }
protected override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public sealed partial class IncrementalHash : System.IDisposable
{
@ -310,17 +316,17 @@ namespace System.Security.Cryptography
public void Dispose() { }
public byte[] GetHashAndReset() { throw null; }
}
public abstract partial class MaskGenerationMethod
{
public abstract byte[] GenerateMask(byte[] rgbSeed, int cbReturn);
}
public abstract partial class MD5 : System.Security.Cryptography.HashAlgorithm
{
protected MD5() { }
public static new System.Security.Cryptography.MD5 Create() { throw null; }
public static new System.Security.Cryptography.MD5 Create(string algName) { throw null; }
}
public abstract class MaskGenerationMethod
{
public abstract byte[] GenerateMask(byte[] rgbSeed, int cbReturn);
}
public class PKCS1MaskGenerationMethod : MaskGenerationMethod
public partial class PKCS1MaskGenerationMethod : System.Security.Cryptography.MaskGenerationMethod
{
public PKCS1MaskGenerationMethod() { }
public string HashName { get { throw null; } set { } }
@ -347,6 +353,24 @@ namespace System.Security.Cryptography
public static new System.Security.Cryptography.RC2 Create() { throw null; }
public static new System.Security.Cryptography.RC2 Create(string AlgName) { throw null; }
}
public partial class Rfc2898DeriveBytes : System.Security.Cryptography.DeriveBytes
{
public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations) { }
public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { }
public Rfc2898DeriveBytes(string password, byte[] salt) { }
public Rfc2898DeriveBytes(string password, byte[] salt, int iterations) { }
public Rfc2898DeriveBytes(string password, byte[] salt, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { }
public Rfc2898DeriveBytes(string password, int saltSize) { }
public Rfc2898DeriveBytes(string password, int saltSize, int iterations) { }
public Rfc2898DeriveBytes(string password, int saltSize, int iterations, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { }
public System.Security.Cryptography.HashAlgorithmName HashAlgorithm { get { throw null; } }
public int IterationCount { get { throw null; } set { } }
public byte[] Salt { get { throw null; } set { } }
public byte[] CryptDeriveKey(string algname, string alghashname, int keySize, byte[] rgbIV) { throw null; }
protected override void Dispose(bool disposing) { }
public override byte[] GetBytes(int cb) { throw null; }
public override void Reset() { }
}
[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))]
public abstract partial class Rijndael : System.Security.Cryptography.SymmetricAlgorithm
{
@ -373,24 +397,6 @@ namespace System.Security.Cryptography
public override void GenerateIV() { }
public override void GenerateKey() { }
}
public partial class Rfc2898DeriveBytes : System.Security.Cryptography.DeriveBytes
{
public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations) { }
public Rfc2898DeriveBytes(byte[] password, byte[] salt, int iterations, HashAlgorithmName hashAlgorithm) { }
public Rfc2898DeriveBytes(string password, byte[] salt) { }
public Rfc2898DeriveBytes(string password, byte[] salt, int iterations) { }
public Rfc2898DeriveBytes(string password, byte[] salt, int iterations, HashAlgorithmName hashAlgorithm) { }
public Rfc2898DeriveBytes(string password, int saltSize) { }
public Rfc2898DeriveBytes(string password, int saltSize, int iterations) { }
public Rfc2898DeriveBytes(string password, int saltSize, int iterations, HashAlgorithmName hashAlgorithm) { }
public HashAlgorithmName HashAlgorithm { get { throw null; } }
public int IterationCount { get { throw null; } set { } }
public byte[] Salt { get { throw null; } set { } }
public byte[] CryptDeriveKey(string algname, string alghashname, int keySize, byte[] rgbIV) { throw null; }
protected override void Dispose(bool disposing) { }
public override byte[] GetBytes(int cb) { throw null; }
public override void Reset() { }
}
public abstract partial class RSA : System.Security.Cryptography.AsymmetricAlgorithm
{
protected RSA() { }
@ -398,16 +404,16 @@ namespace System.Security.Cryptography
public override string SignatureAlgorithm { get { throw null; } }
public static new System.Security.Cryptography.RSA Create() { throw null; }
public static System.Security.Cryptography.RSA Create(int keySizeInBits) { throw null; }
public static new System.Security.Cryptography.RSA Create(string algName) { throw null; }
public static System.Security.Cryptography.RSA Create(System.Security.Cryptography.RSAParameters parameters) { throw null; }
public static new System.Security.Cryptography.RSA Create(string algName) { throw null; }
public virtual byte[] Decrypt(byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding) { throw null; }
public virtual byte[] DecryptValue(byte[] rgb) { throw null; }
public virtual byte[] Encrypt(byte[] data, System.Security.Cryptography.RSAEncryptionPadding padding) { throw null; }
public virtual byte[] EncryptValue(byte[] rgb) { throw null; }
public abstract System.Security.Cryptography.RSAParameters ExportParameters(bool includePrivateParameters);
public override void FromXmlString(string xmlString) { }
protected virtual byte[] HashData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; }
protected virtual byte[] HashData(System.IO.Stream data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm) { throw null; }
public override void FromXmlString(string xmlString) { }
public abstract void ImportParameters(System.Security.Cryptography.RSAParameters parameters);
public virtual byte[] SignData(byte[] data, int offset, int count, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; }
public byte[] SignData(byte[] data, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, System.Security.Cryptography.RSASignaturePadding padding) { throw null; }
@ -456,12 +462,11 @@ namespace System.Security.Cryptography
public RSAOAEPKeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { }
public byte[] Parameter { get { throw null; } set { } }
public override string Parameters { get { throw null; } }
public RandomNumberGenerator Rng { get { throw null; } set { } }
public System.Security.Cryptography.RandomNumberGenerator Rng { get { throw null; } set { } }
public override byte[] CreateKeyExchange(byte[] rgbData) { throw null; }
public override byte[] CreateKeyExchange(byte[] rgbData, System.Type symAlgType) { throw null; }
public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct RSAParameters
{
public byte[] D;
@ -477,8 +482,8 @@ namespace System.Security.Cryptography
{
public RSAPKCS1KeyExchangeDeformatter() { }
public RSAPKCS1KeyExchangeDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { }
public RandomNumberGenerator RNG { get { throw null; } set { } }
public override string Parameters { get { throw null; } set { } }
public System.Security.Cryptography.RandomNumberGenerator RNG { get { throw null; } set { } }
public override byte[] DecryptKeyExchange(byte[] rgbIn) { throw null; }
public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { }
}
@ -487,7 +492,7 @@ namespace System.Security.Cryptography
public RSAPKCS1KeyExchangeFormatter() { }
public RSAPKCS1KeyExchangeFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { }
public override string Parameters { get { throw null; } }
public RandomNumberGenerator Rng { get { throw null; } set { } }
public System.Security.Cryptography.RandomNumberGenerator Rng { get { throw null; } set { } }
public override byte[] CreateKeyExchange(byte[] rgbData) { throw null; }
public override byte[] CreateKeyExchange(byte[] rgbData, System.Type symAlgType) { throw null; }
public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key) { }
@ -538,8 +543,10 @@ namespace System.Security.Cryptography
public SHA1Managed() { }
protected sealed override void Dispose(bool disposing) { }
protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { }
protected sealed override void HashCore(System.ReadOnlySpan<byte> source) { }
protected sealed override byte[] HashFinal() { throw null; }
public sealed override void Initialize() { }
protected sealed override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public abstract partial class SHA256 : System.Security.Cryptography.HashAlgorithm
{
@ -553,8 +560,10 @@ namespace System.Security.Cryptography
public SHA256Managed() { }
protected sealed override void Dispose(bool disposing) { }
protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { }
protected sealed override void HashCore(System.ReadOnlySpan<byte> source) { }
protected sealed override byte[] HashFinal() { throw null; }
public sealed override void Initialize() { }
protected sealed override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public abstract partial class SHA384 : System.Security.Cryptography.HashAlgorithm
{
@ -568,8 +577,10 @@ namespace System.Security.Cryptography
public SHA384Managed() { }
protected sealed override void Dispose(bool disposing) { }
protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { }
protected sealed override void HashCore(System.ReadOnlySpan<byte> source) { }
protected sealed override byte[] HashFinal() { throw null; }
public sealed override void Initialize() { }
protected sealed override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public abstract partial class SHA512 : System.Security.Cryptography.HashAlgorithm
{
@ -583,16 +594,19 @@ namespace System.Security.Cryptography
public SHA512Managed() { }
protected sealed override void Dispose(bool disposing) { }
protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) { }
protected sealed override void HashCore(System.ReadOnlySpan<byte> source) { }
protected sealed override byte[] HashFinal() { throw null; }
public sealed override void Initialize() { }
protected sealed override bool TryHashFinal(System.Span<byte> destination, out int bytesWritten) { throw null; }
}
public partial class SignatureDescription {
public partial class SignatureDescription
{
public SignatureDescription() { }
public SignatureDescription(System.Security.SecurityElement el) { }
public string DeformatterAlgorithm { get { throw null; } set { } }
public string DigestAlgorithm { get { throw null;} set { } }
public string FormatterAlgorithm { get { throw null;} set { } }
public string KeyAlgorithm { get { throw null;} set { } }
public string DigestAlgorithm { get { throw null; } set { } }
public string FormatterAlgorithm { get { throw null; } set { } }
public string KeyAlgorithm { get { throw null; } set { } }
public virtual System.Security.Cryptography.AsymmetricSignatureDeformatter CreateDeformatter(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; }
public virtual System.Security.Cryptography.HashAlgorithm CreateDigest() { throw null; }
public virtual System.Security.Cryptography.AsymmetricSignatureFormatter CreateFormatter(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; }

View File

@ -95,7 +95,7 @@ namespace Internal.Cryptography
}
uint length = (uint)destination.Length;
Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref destination.DangerousGetPinnableReference(), ref length));
Check(Interop.Crypto.EvpDigestFinalEx(_ctx, ref MemoryMarshal.GetReference(destination), ref length));
Debug.Assert(length == _hashSize);
bytesWritten = (int)length;
@ -132,7 +132,7 @@ namespace Internal.Cryptography
throw new CryptographicException();
}
_hmacCtx = Interop.Crypto.HmacCreate(ref new Span<byte>(key).DangerousGetPinnableReference(), key.Length, algorithmEvp);
_hmacCtx = Interop.Crypto.HmacCreate(ref MemoryMarshal.GetReference(new Span<byte>(key)), key.Length, algorithmEvp);
Interop.Crypto.CheckValidOpenSslHandle(_hmacCtx);
}
@ -157,7 +157,7 @@ namespace Internal.Cryptography
}
int length = destination.Length;
Check(Interop.Crypto.HmacFinal(_hmacCtx, ref destination.DangerousGetPinnableReference(), ref length));
Check(Interop.Crypto.HmacFinal(_hmacCtx, ref MemoryMarshal.GetReference(destination), ref length));
Debug.Assert(length == _hashSize);
bytesWritten = length;

View File

@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
namespace System.Security.Cryptography
{
internal sealed partial class RandomNumberGeneratorImplementation : RandomNumberGenerator
@ -22,7 +24,7 @@ namespace System.Security.Cryptography
{
if (data.Length > 0)
{
GetBytes(ref data.DangerousGetPinnableReference(), data.Length);
GetBytes(ref MemoryMarshal.GetReference(data), data.Length);
}
}

View File

@ -478,9 +478,9 @@
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
<Reference Include="System.Buffers" />
<Reference Include="System.Collections" />
<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Memory" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
@ -500,4 +500,4 @@
<Compile Include="System\Security\Cryptography\IncrementalHash.net46.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@ -245,11 +245,11 @@ namespace System.Security.Cryptography.CryptoConfigTests
yield return new object[] { "X509Chain", "System.Security.Cryptography.X509Certificates.X509Chain", true };
// PKCS9 attributes
yield return new object[] { "1.2.840.113549.1.9.3", "System.Security.Cryptography.Pkcs.Pkcs9ContentType", false };
yield return new object[] { "1.2.840.113549.1.9.4", "System.Security.Cryptography.Pkcs.Pkcs9MessageDigest", false };
yield return new object[] { "1.2.840.113549.1.9.5", "System.Security.Cryptography.Pkcs.Pkcs9SigningTime", false };
yield return new object[] { "1.3.6.1.4.1.311.88.2.1", "System.Security.Cryptography.Pkcs.Pkcs9DocumentName", false };
yield return new object[] { "1.3.6.1.4.1.311.88.2.2", "System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription", false };
yield return new object[] { "1.2.840.113549.1.9.3", "System.Security.Cryptography.Pkcs.Pkcs9ContentType", true };
yield return new object[] { "1.2.840.113549.1.9.4", "System.Security.Cryptography.Pkcs.Pkcs9MessageDigest", true };
yield return new object[] { "1.2.840.113549.1.9.5", "System.Security.Cryptography.Pkcs.Pkcs9SigningTime", true };
yield return new object[] { "1.3.6.1.4.1.311.88.2.1", "System.Security.Cryptography.Pkcs.Pkcs9DocumentName", true };
yield return new object[] { "1.3.6.1.4.1.311.88.2.2", "System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription", true };
}
}