From e7cb9e780da9b4ed2cee55feb0c4e7302222267d Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 4 May 2023 16:43:06 +0700 Subject: Refactoring around BasicConstraints --- crypto/src/x509/X509Certificate.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'crypto/src/x509/X509Certificate.cs') diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs index c903811d4..30cdd6e2d 100644 --- a/crypto/src/x509/X509Certificate.cs +++ b/crypto/src/x509/X509Certificate.cs @@ -364,17 +364,10 @@ namespace Org.BouncyCastle.X509 public virtual int GetBasicConstraints() { - if (basicConstraints != null && basicConstraints.IsCA()) - { - if (basicConstraints.PathLenConstraint == null) - { - return int.MaxValue; - } - - return basicConstraints.PathLenConstraint.IntValue; - } + if (basicConstraints == null || !basicConstraints.IsCA()) + return -1; - return -1; + return basicConstraints.PathLenConstraint_Int32; } public virtual GeneralNames GetIssuerAlternativeNameExtension() -- cgit 1.4.1