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
@@ -2,7 +2,8 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<AssemblyVersion>4.1.1.0</AssemblyVersion>
|
||||
<AssemblyKey>MSFT</AssemblyKey>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsUAP>true</IsUAP>
|
||||
</PropertyGroup>
|
||||
|
@@ -11,7 +11,6 @@ namespace System.Security.Cryptography
|
||||
// electronic code book (ECB),
|
||||
// ciphertext-stealing (CTS).
|
||||
// Not all implementations will support all modes.
|
||||
[Serializable]
|
||||
public enum CipherMode
|
||||
{
|
||||
CBC = 1,
|
||||
|
@@ -7,7 +7,6 @@ using System.Diagnostics;
|
||||
|
||||
namespace System.Security.Cryptography
|
||||
{
|
||||
[Serializable]
|
||||
public enum CryptoStreamMode
|
||||
{
|
||||
Read = 0,
|
||||
|
@@ -33,6 +33,7 @@ namespace System.Security.Cryptography
|
||||
protected CryptographicUnexpectedOperationException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,9 @@ namespace System.Security.Cryptography
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
throw new ArgumentNullException(nameof(HashName));
|
||||
|
||||
// On the desktop, setting the HashName selects (or switches over to) a new hashing algorithm via CryptoConfig.
|
||||
// Our intended refactoring turns HMAC back into an abstract class with no algorithm-specific implementation.
|
||||
// Changing the HashName would not have the intended effect so throw a proper exception so the developer knows what's up.
|
||||
@@ -50,6 +53,7 @@ namespace System.Security.Cryptography
|
||||
|
||||
if (_hashName != null && value != _hashName)
|
||||
throw new PlatformNotSupportedException(SR.HashNameMultipleSetNotSupported);
|
||||
|
||||
_hashName = value;
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@ namespace System.Security.Cryptography
|
||||
// "ISO 10126" is the same as PKCS5 except that it fills the bytes before the last one with
|
||||
// random bytes.
|
||||
// "ANSI X.923" fills the bytes with zeros and puts the number of padding bytes in the last byte.
|
||||
[Serializable]
|
||||
public enum PaddingMode
|
||||
{
|
||||
None = 1,
|
||||
|
@@ -42,6 +42,7 @@ namespace System.Security.Cryptography.Encryption.Tests.Asymmetric
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Throws NRE on netfx (https://github.com/dotnet/corefx/issues/18690)")]
|
||||
public static void ValidKeySizeUsesProperty()
|
||||
{
|
||||
using (AsymmetricAlgorithm aa = new DoesNotSetLegalKeySizesField())
|
||||
|
@@ -17,7 +17,15 @@ namespace System.Security.Cryptography.Encryption.Tests.Asymmetric
|
||||
Assert.NotNull(new CryptographicException().Message);
|
||||
Assert.Equal(message, new CryptographicException(message).Message);
|
||||
Assert.Equal(message + " 12345", new CryptographicException(message + " {0}", "12345").Message);
|
||||
Assert.Equal(5, new CryptographicException(5).HResult);
|
||||
if (PlatformDetection.IsFullFramework)
|
||||
{
|
||||
Assert.Equal(unchecked((int)0x80070005), new CryptographicException(5).HResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal(5, new CryptographicException(5).HResult);
|
||||
}
|
||||
|
||||
Assert.Same(inner, new CryptographicException(message, inner).InnerException);
|
||||
Assert.Equal(message, new CryptographicException(message, inner).Message);
|
||||
}
|
||||
|
@@ -13,9 +13,7 @@ namespace System.Security.Cryptography.Hashing.Tests
|
||||
{
|
||||
using (HMAC hmac = new TestHMAC())
|
||||
{
|
||||
// Assert.NoThrows is implicit
|
||||
hmac.HashName = null;
|
||||
|
||||
Assert.Throws<ArgumentNullException>(() => hmac.HashName = null);
|
||||
Assert.Null(hmac.HashName);
|
||||
}
|
||||
}
|
||||
@@ -43,9 +41,16 @@ namespace System.Security.Cryptography.Hashing.Tests
|
||||
|
||||
// On desktop builds this next line will succeed (modulo FIPS prohibitions on MD5).
|
||||
// On CoreFX it throws.
|
||||
Assert.Throws<PlatformNotSupportedException>(() => hmac.HashName = "MD5");
|
||||
|
||||
Assert.Equal("SHA1", hmac.HashName);
|
||||
if (PlatformDetection.IsFullFramework)
|
||||
{
|
||||
hmac.HashName = "MD5";
|
||||
Assert.Equal("MD5", hmac.HashName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Throws<PlatformNotSupportedException>(() => hmac.HashName = "MD5");
|
||||
Assert.Equal("SHA1", hmac.HashName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +80,14 @@ namespace System.Security.Cryptography.Hashing.Tests
|
||||
hmac.Key = Array.Empty<byte>();
|
||||
|
||||
byte[] ignored;
|
||||
Assert.Throws<PlatformNotSupportedException>(() => ignored = hmac.ComputeHash(Array.Empty<byte>()));
|
||||
if (PlatformDetection.IsFullFramework)
|
||||
{
|
||||
ignored = hmac.ComputeHash(Array.Empty<byte>());
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Throws<PlatformNotSupportedException>(() => ignored = hmac.ComputeHash(Array.Empty<byte>()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -49,6 +49,7 @@ namespace System.Security.Cryptography.Hashing.Tests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Throws NRE on netfx (https://github.com/dotnet/corefx/issues/18690)")]
|
||||
public void EnsureDisposeFreesKey()
|
||||
{
|
||||
byte[] key = new[] { (byte)0x00, (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, };
|
||||
@@ -64,6 +65,7 @@ namespace System.Security.Cryptography.Hashing.Tests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Throws NRE on netfx (https://github.com/dotnet/corefx/issues/18690)")]
|
||||
public void SetKeyNull()
|
||||
{
|
||||
using (var keyedHash = new TestKeyedHashAlgorithm())
|
||||
|
@@ -117,7 +117,15 @@ namespace System.Security.Cryptography.Encryption.Tests.Symmetric
|
||||
try
|
||||
{
|
||||
byte[] hugeKey = new byte[536870917]; // value chosen so that when multiplied by 8 (bits) it overflows to the value 40
|
||||
Assert.Throws<CryptographicException>(() => s.Key = hugeKey);
|
||||
if (PlatformDetection.IsFullFramework)
|
||||
{
|
||||
// This change should be ported to netfx
|
||||
s.Key = hugeKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Throws<CryptographicException>(() => s.Key = hugeKey);
|
||||
}
|
||||
}
|
||||
catch (OutOfMemoryException) { } // in case there isn't enough memory at test-time to allocate the large array
|
||||
}
|
||||
@@ -281,6 +289,7 @@ namespace System.Security.Cryptography.Encryption.Tests.Symmetric
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Throws NRE on netfx (https://github.com/dotnet/corefx/issues/18690)")]
|
||||
public static void SetBlockSize_Uses_LegalBlockSizesProperty()
|
||||
{
|
||||
using (SymmetricAlgorithm s = new DoesNotSetKeySizesFields())
|
||||
@@ -289,7 +298,7 @@ namespace System.Security.Cryptography.Encryption.Tests.Symmetric
|
||||
s.BlockSize = 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static byte[] GenerateRandom(int size)
|
||||
{
|
||||
byte[] data = new byte[size];
|
||||
|
@@ -24,6 +24,9 @@
|
||||
<Compile Include="$(CommonTestPath)\System\IO\PositionValueStream.cs">
|
||||
<Link>CommonTest\System\IO\PositionValueStream.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
|
||||
<Link>CommonTest\System\PlatformDetection.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)'=='netcoreapp'">
|
||||
<Compile Include="CryptoConfigTests.cs" />
|
||||
|
Reference in New Issue
Block a user