diff options
Diffstat (limited to 'crypto/src/x509/X509CertificateParser.cs')
-rw-r--r-- | crypto/src/x509/X509CertificateParser.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/src/x509/X509CertificateParser.cs b/crypto/src/x509/X509CertificateParser.cs index ce50dc8ed..6fc1b3ff4 100644 --- a/crypto/src/x509/X509CertificateParser.cs +++ b/crypto/src/x509/X509CertificateParser.cs @@ -138,7 +138,10 @@ namespace Org.BouncyCastle.X509 if (tag != 0x30) // assume ascii PEM encoded. return ReadPemCertificate(inStream); - return ReadDerCertificate(new Asn1InputStream(inStream)); + using (var asn1In = new Asn1InputStream(inStream, int.MaxValue, leaveOpen: true)) + { + return ReadDerCertificate(asn1In); + } } catch (Exception e) { |