summary refs log tree commit diff
path: root/crypto/src/crypto/tls/TlsUtilities.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-11-14 17:29:37 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-11-14 17:29:37 +0700
commit21f2eacb456c933df98a59a78143dfd1a05bb951 (patch)
tree368016a4f0a7885d0e01a952489b117c6e3e134a /crypto/src/crypto/tls/TlsUtilities.cs
parentUpdate ECPrivateKeyStructure following Java API (diff)
downloadBouncyCastle.NET-ed25519-21f2eacb456c933df98a59a78143dfd1a05bb951.tar.xz
Check there is no trailing data in Asn1Object.FromByteArray
Diffstat (limited to 'crypto/src/crypto/tls/TlsUtilities.cs')
-rw-r--r--crypto/src/crypto/tls/TlsUtilities.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/src/crypto/tls/TlsUtilities.cs b/crypto/src/crypto/tls/TlsUtilities.cs

index a8c8a2b28..26fb0d5e8 100644 --- a/crypto/src/crypto/tls/TlsUtilities.cs +++ b/crypto/src/crypto/tls/TlsUtilities.cs
@@ -529,11 +529,12 @@ namespace Org.BouncyCastle.Crypto.Tls public static Asn1Object ReadAsn1Object(byte[] encoding) { - Asn1InputStream asn1 = new Asn1InputStream(encoding); + MemoryStream input = new MemoryStream(encoding, false); + Asn1InputStream asn1 = new Asn1InputStream(input, encoding.Length); Asn1Object result = asn1.ReadObject(); if (null == result) throw new TlsFatalAlert(AlertDescription.decode_error); - if (null != asn1.ReadObject()) + if (input.Position != input.Length) throw new TlsFatalAlert(AlertDescription.decode_error); return result; }