diff options
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/asn1/test/DERUTF8StringTest.cs | 5 | ||||
-rw-r--r-- | crypto/test/src/asn1/test/SetTest.cs | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/crypto/test/src/asn1/test/DERUTF8StringTest.cs b/crypto/test/src/asn1/test/DERUTF8StringTest.cs index be4dace79..15f98a7c4 100644 --- a/crypto/test/src/asn1/test/DERUTF8StringTest.cs +++ b/crypto/test/src/asn1/test/DERUTF8StringTest.cs @@ -66,8 +66,9 @@ namespace Org.BouncyCastle.Asn1.Tests byte[] b1 = new DerUtf8String(s).GetEncoded(); byte[] temp = new byte[b1.Length - 2]; Array.Copy(b1, 2, temp, 0, b1.Length - 2); - byte[] b2 = new DerUtf8String(new DerOctetString(temp).GetOctets()).GetEncoded(); - if (!Arrays.AreEqual(b1, b2)) + byte[] b2 = new DerUtf8String(Strings.FromUtf8ByteArray(new DerOctetString(temp).GetOctets())) + .GetEncoded(); + if (!Arrays.AreEqual(b1, b2)) { return new SimpleTestResult(false, Name + ": failed UTF-8 encoding and decoding"); } diff --git a/crypto/test/src/asn1/test/SetTest.cs b/crypto/test/src/asn1/test/SetTest.cs index 57c46603d..b7da0a9b7 100644 --- a/crypto/test/src/asn1/test/SetTest.cs +++ b/crypto/test/src/asn1/test/SetTest.cs @@ -83,7 +83,11 @@ namespace Org.BouncyCastle.Asn1.Tests // create an implicitly tagged "set" without sorting Asn1TaggedObject tag = new DerTaggedObject(false, 1, new DerSequence(v)); - s = Asn1Set.GetInstance(tag, false); + + // Encode/decode to get 'tag' as a parsed instance + tag = (Asn1TaggedObject)Asn1Object.FromByteArray(tag.GetEncoded(Asn1Encodable.Der));; + + s = Asn1Set.GetInstance(tag, false); if (s[0] is DerBoolean) { |