Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Barton <jbarton@microsoft.com>2018-02-21 02:23:21 +0300
committerGitHub <noreply@github.com>2018-02-21 02:23:21 +0300
commitd4534e7b03bfa37b6141cc6c45321945cd317ef0 (patch)
tree03b474423a427eddaa152ddd11a469b541f6c3be /src/System.Security.Cryptography.Encoding/tests
parent1fd7d79fc36ca113bdabbee4204e15ae5bcde24a (diff)
Support for RFC 3161 cryptographic timestamps with RFC 5816 additions
This change adds API to consume, and produce, cryptographic timestamp tokens compliant with RFC 3161, or with the RFC 5816's extensions to support certificate thumbprint algorithms other than SHA-1. In addition to the low-level production and consumption, accelerator API exists for applying RFC 3161 Appendix A rules for (counter-)signing a SignedCMS SignerInfo signature.
Diffstat (limited to 'src/System.Security.Cryptography.Encoding/tests')
-rw-r--r--src/System.Security.Cryptography.Encoding/tests/Asn1/Serializer/SimpleDeserialize.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Serializer/SimpleDeserialize.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Serializer/SimpleDeserialize.cs
index 6ca6a21036..1b19ddd670 100644
--- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Serializer/SimpleDeserialize.cs
+++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Serializer/SimpleDeserialize.cs
@@ -442,7 +442,7 @@ namespace System.Security.Cryptography.Tests.Asn1
}
[Fact]
- public static void TooMuchData()
+ public static void TooMuchDataInValue()
{
// This is { IA5String("IA5"), UTF8String("UTF8") }, which is the opposite
// of the field order of OptionalValues. SO it will see the UTF8String as null,
@@ -452,6 +452,24 @@ namespace System.Security.Cryptography.Tests.Asn1
Assert.Throws<CryptographicException>(
() => AsnSerializer.Deserialize<OptionalValues>(inputData, AsnEncodingRules.BER));
}
+
+ [Fact]
+ public static void TooMuchDataForValue()
+ {
+ // Two empty sequences, which is more data than one OptionalValues value.
+ byte[] inputData = "30003000".HexToByteArray();
+
+ OptionalValues parsed = AsnSerializer.Deserialize<OptionalValues>(
+ inputData,
+ AsnEncodingRules.BER,
+ out int bytesRead);
+
+ Assert.NotNull(parsed);
+ Assert.Equal(2, bytesRead);
+
+ Assert.Throws<CryptographicException>(
+ () => AsnSerializer.Deserialize<OptionalValues>(inputData, AsnEncodingRules.BER));
+ }
}
// RFC 3280 / ITU-T X.509