You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.142
Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
parent
e52655b4dc
commit
0abdbe5a7d
@@ -17,13 +17,8 @@ using X509IssuerSerial = System.Security.Cryptography.Xml.X509IssuerSerial;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
internal static class Helpers
|
||||
internal static partial class Helpers
|
||||
{
|
||||
public static byte[] CloneByteArray(this byte[] a)
|
||||
{
|
||||
return (byte[])(a.Clone());
|
||||
}
|
||||
|
||||
#if !netcoreapp
|
||||
// Compatibility API.
|
||||
internal static void AppendData(this IncrementalHash hasher, ReadOnlySpan<byte> data)
|
||||
|
||||
@@ -54,7 +54,16 @@ namespace Internal.Cryptography.Pal.Windows
|
||||
|
||||
public sealed override byte[] EncodeUtcTime(DateTime utcTime)
|
||||
{
|
||||
long ft = utcTime.ToFileTimeUtc();
|
||||
long ft;
|
||||
try
|
||||
{
|
||||
ft = utcTime.ToFileTimeUtc();
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
{
|
||||
throw new CryptographicException(ex.Message, ex);
|
||||
}
|
||||
|
||||
unsafe
|
||||
{
|
||||
return Interop.Crypt32.CryptEncodeObjectToByteArray(CryptDecodeObjectStructType.PKCS_UTC_TIME, &ft);
|
||||
|
||||
@@ -65,6 +65,9 @@
|
||||
<Compile Include="Internal\Cryptography\Helpers.cs" />
|
||||
<Compile Include="Internal\Cryptography\PkcsPal.cs" />
|
||||
<Compile Include="Internal\Cryptography\RecipientInfoPal.cs" />
|
||||
<Compile Include="$(CommonPath)\Internal\Cryptography\Helpers.cs">
|
||||
<Link>Internal\Cryptography\Helpers.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<!-- Internal types (platform: Windows) -->
|
||||
<ItemGroup Condition="'$(TargetsWindows)' == 'true' AND '$(IsPartialFacadeAssembly)' != 'true'">
|
||||
|
||||
@@ -27,6 +27,19 @@ namespace System.Security.Cryptography.Pkcs.Tests
|
||||
Assert.Throws<ArgumentNullException>(() => ign = new Pkcs9AttributeObject(a));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void InputDateTimeAsWindowsFileTimeBefore1601()
|
||||
{
|
||||
DateTime dt = new DateTime(1600, 12, 31, 11, 59, 59, DateTimeKind.Utc);
|
||||
AssertExtensions.Throws<CryptographicException, ArgumentOutOfRangeException>(() => new Pkcs9SigningTime(dt));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void Pkcs9SigningTime_DateTimeMinValue()
|
||||
{
|
||||
AssertExtensions.Throws<CryptographicException, ArgumentOutOfRangeException>(() => new Pkcs9SigningTime(DateTime.MinValue));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public static void InputDateTimeAsX509TimeBefore1950_Utc()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user