From eec1e384fc311c22550cc4654fcf8272d65e2978 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 5 May 2023 19:00:34 +0700 Subject: Improvements to pathLenConstraints checks --- crypto/src/x509/X509Certificate.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crypto/src/x509') diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs index 30cdd6e2d..b1307d90e 100644 --- a/crypto/src/x509/X509Certificate.cs +++ b/crypto/src/x509/X509Certificate.cs @@ -367,7 +367,11 @@ namespace Org.BouncyCastle.X509 if (basicConstraints == null || !basicConstraints.IsCA()) return -1; - return basicConstraints.PathLenConstraint_Int32; + var pathLenConstraint = basicConstraints.PathLenConstraintInteger; + if (pathLenConstraint == null) + return int.MaxValue; + + return pathLenConstraint.IntPositiveValueExact; } public virtual GeneralNames GetIssuerAlternativeNameExtension() -- cgit 1.4.1