diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-05 14:45:49 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-05 14:45:49 +0700 |
commit | 6b59dbbece3b1509b83b8479259a3c6059e9a60b (patch) | |
tree | 3dca66ea9a1e8aa02ac6099cde5844155783bd7b /crypto/src/x509/X509CertPairParser.cs | |
parent | Refactor Asn1Set classes (diff) | |
download | BouncyCastle.NET-ed25519-6b59dbbece3b1509b83b8479259a3c6059e9a60b.tar.xz |
Support 'leaveOpen' in Asn1 streams
Diffstat (limited to 'crypto/src/x509/X509CertPairParser.cs')
-rw-r--r-- | crypto/src/x509/X509CertPairParser.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crypto/src/x509/X509CertPairParser.cs b/crypto/src/x509/X509CertPairParser.cs index 26b417898..95ba522c8 100644 --- a/crypto/src/x509/X509CertPairParser.cs +++ b/crypto/src/x509/X509CertPairParser.cs @@ -13,13 +13,12 @@ namespace Org.BouncyCastle.X509 { private Stream currentStream; - private X509CertificatePair ReadDerCrossCertificatePair( - Stream inStream) + private X509CertificatePair ReadDerCrossCertificatePair(Stream inStream) { - Asn1InputStream dIn = new Asn1InputStream(inStream);//, ProviderUtil.getReadLimit(in)); - Asn1Sequence seq = (Asn1Sequence)dIn.ReadObject(); - CertificatePair pair = CertificatePair.GetInstance(seq); - return new X509CertificatePair(pair); + using (var asn1In = new Asn1InputStream(inStream, int.MaxValue, leaveOpen: true)) + { + return new X509CertificatePair(CertificatePair.GetInstance(asn1In.ReadObject())); + } } /// <summary> |