diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-15 01:18:46 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-15 01:18:46 +0700 |
commit | d3fd5f9580f7f9d5f2d63f86e8e08d22ad18654c (patch) | |
tree | ae679455ccc8aae2c64a0a23823b1a7ee9f12469 /crypto/test/src/asn1 | |
parent | Add utility methods (diff) | |
download | BouncyCastle.NET-ed25519-d3fd5f9580f7f9d5f2d63f86e8e08d22ad18654c.tar.xz |
ASN1InputStream updates from bc-java
- improve tag validation - improve handling of long form definite-length
Diffstat (limited to 'crypto/test/src/asn1')
-rw-r--r-- | crypto/test/src/asn1/test/InputStreamTest.cs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/crypto/test/src/asn1/test/InputStreamTest.cs b/crypto/test/src/asn1/test/InputStreamTest.cs index 4cfb304d1..32eafe27c 100644 --- a/crypto/test/src/asn1/test/InputStreamTest.cs +++ b/crypto/test/src/asn1/test/InputStreamTest.cs @@ -38,23 +38,24 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (IOException e) { - if (!e.Message.StartsWith("DER length more than 4 bytes")) - { + if (!e.Message.Equals("invalid long form definite-length 0xFF")) + { Fail("wrong exception: " + e.Message); } } - aIn = new Asn1InputStream(negativeLength); + // NOTE: Not really a "negative" length, but 32 bits + aIn = new Asn1InputStream(negativeLength); - try - { + try + { aIn.ReadObject(); Fail("negative length not detected."); } catch (IOException e) { - if (!e.Message.Equals("corrupted stream - negative length found")) - { + if (!e.Message.Equals("long form definite-length more than 31 bits")) + { Fail("wrong exception: " + e.Message); } } |