ASN.1 updates from bc-java
- Integer cannot have empty contents octets
- Enumerated values can't be negative
1 files changed, 16 insertions, 5 deletions
diff --git a/crypto/test/src/asn1/test/ASN1IntegerTest.cs b/crypto/test/src/asn1/test/ASN1IntegerTest.cs
index 6de3f7507..35366ea96 100644
--- a/crypto/test/src/asn1/test/ASN1IntegerTest.cs
+++ b/crypto/test/src/asn1/test/ASN1IntegerTest.cs
@@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Asn1.Tests
new DerInteger(Hex.Decode("ffda47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e"));
- new DerEnumerated(Hex.Decode("ffda47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e"));
+ new DerEnumerated(Hex.Decode("005a47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e"));
SetAllowUnsafeProperty(false);
@@ -102,6 +102,17 @@ namespace Org.BouncyCastle.Asn1.Tests
{
IsEquals("malformed enumerated", e.Message);
}
+
+ try
+ {
+ new DerEnumerated(Hex.Decode("005a47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e"));
+
+ Fail("no exception");
+ }
+ catch (ArgumentException e)
+ {
+ IsEquals("malformed enumerated", e.Message);
+ }
#endif
}
@@ -173,7 +184,7 @@ namespace Org.BouncyCastle.Asn1.Tests
try
{
byte[] rawInt = Hex.Decode("FF81FF");
- DerInteger i = new DerInteger(rawInt);
+ new DerInteger(rawInt);
Fail("Expecting illegal argument exception.");
}
catch (ArgumentException e)
@@ -212,7 +223,7 @@ namespace Org.BouncyCastle.Asn1.Tests
try
{
byte[] rawInt = Hex.Decode("FFFFFFFF01FF");
- DerInteger i = new DerInteger(rawInt);
+ new DerInteger(rawInt);
Fail("Expecting illegal argument exception.");
}
catch (ArgumentException e)
@@ -235,7 +246,7 @@ namespace Org.BouncyCastle.Asn1.Tests
{
SetAllowUnsafeProperty(true);
byte[] rawInt = Hex.Decode("0000000010FF");
- DerInteger i = new DerInteger(rawInt);
+ new DerInteger(rawInt);
Fail("Expecting illegal argument exception.");
}
catch (ArgumentException e)
@@ -254,7 +265,7 @@ namespace Org.BouncyCastle.Asn1.Tests
{
SetAllowUnsafeProperty(true);
byte[] rawInt = Hex.Decode("FFFFFFFF10FF");
- DerInteger i = new DerInteger(rawInt);
+ new DerInteger(rawInt);
Fail("Expecting illegal argument exception.");
}
catch (ArgumentException e)
|