summary refs log tree commit diff
path: root/crypto/src/x509/X509Crl.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/x509/X509Crl.cs')
-rw-r--r--crypto/src/x509/X509Crl.cs21
1 files changed, 12 insertions, 9 deletions
diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs
index 5a1ce95e2..9c3e0fd03 100644
--- a/crypto/src/x509/X509Crl.cs
+++ b/crypto/src/x509/X509Crl.cs
@@ -59,10 +59,11 @@ namespace Org.BouncyCastle.X509
         }
 
         private readonly CertificateList c;
-		private readonly string sigAlgName;
 		private readonly byte[] sigAlgParams;
 		private readonly bool isIndirect;
 
+        private string m_sigAlgName = null;
+
         private CachedEncoding cachedEncoding;
 
         private volatile bool hashValueSet;
@@ -79,10 +80,8 @@ namespace Org.BouncyCastle.X509
 
 			try
 			{
-				this.sigAlgName = X509SignatureUtilities.GetSignatureName(c.SignatureAlgorithm);
-
                 Asn1Encodable parameters = c.SignatureAlgorithm.Parameters;
-                this.sigAlgParams = (null == parameters) ? null : parameters.GetEncoded(Asn1Encodable.Der);
+                this.sigAlgParams = parameters?.GetEncoded(Asn1Encodable.Der);
 
                 this.isIndirect = IsIndirectCrl;
 			}
@@ -270,12 +269,14 @@ namespace Org.BouncyCastle.X509
 			return c.GetSignatureOctets();
 		}
 
-		public virtual string SigAlgName
-		{
-			get { return sigAlgName; }
-		}
+        /// <summary>
+		/// A meaningful version of the Signature Algorithm. (e.g. SHA1WITHRSA)
+		/// </summary>
+		/// <returns>A string representing the signature algorithm.</returns>
+        public virtual string SigAlgName => Objects.EnsureSingletonInitialized(ref m_sigAlgName, SignatureAlgorithm,
+            X509SignatureUtilities.GetSignatureName);
 
-		public virtual string SigAlgOid
+        public virtual string SigAlgOid
 		{
             get { return c.SignatureAlgorithm.Algorithm.Id; }
 		}
@@ -285,6 +286,8 @@ namespace Org.BouncyCastle.X509
 			return Arrays.Clone(sigAlgParams);
 		}
 
+        public virtual AlgorithmIdentifier SignatureAlgorithm => c.SignatureAlgorithm;
+
         /// <summary>
         /// Return the DER encoding of this CRL.
         /// </summary>