summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/asn1/x509/X509Extension.cs2
-rw-r--r--crypto/src/asn1/x509/X509Extensions.cs28
-rw-r--r--crypto/src/tsp/TimeStampRequest.cs2
-rw-r--r--crypto/src/x509/X509ExtensionBase.cs14
4 files changed, 22 insertions, 24 deletions
diff --git a/crypto/src/asn1/x509/X509Extension.cs b/crypto/src/asn1/x509/X509Extension.cs
index 430ce4447..9f9378d14 100644
--- a/crypto/src/asn1/x509/X509Extension.cs
+++ b/crypto/src/asn1/x509/X509Extension.cs
@@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
 		public Asn1OctetString Value { get { return value; } }
 
-		public Asn1Encodable GetParsedValue()
+		public Asn1Object GetParsedValue()
 		{
 			return ConvertValueToObject(this);
 		}
diff --git a/crypto/src/asn1/x509/X509Extensions.cs b/crypto/src/asn1/x509/X509Extensions.cs
index 6396f9ddc..b5906c2e1 100644
--- a/crypto/src/asn1/x509/X509Extensions.cs
+++ b/crypto/src/asn1/x509/X509Extensions.cs
@@ -188,15 +188,14 @@ namespace Org.BouncyCastle.Asn1.X509
             new Dictionary<DerObjectIdentifier, X509Extension>();
         private readonly List<DerObjectIdentifier> m_ordering;
 
-        public static X509Extension GetExtension(X509Extensions extensions, DerObjectIdentifier oid)
-        {
-            return extensions?.GetExtension(oid);
-        }
+        public static X509Extension GetExtension(X509Extensions extensions, DerObjectIdentifier oid) =>
+            extensions?.GetExtension(oid);
 
-        public static Asn1Encodable GetExtensionParsedValue(X509Extensions extensions, DerObjectIdentifier oid)
-        {
-            return extensions?.GetExtensionParsedValue(oid);
-        }
+        public static Asn1Object GetExtensionParsedValue(X509Extensions extensions, DerObjectIdentifier oid) =>
+            extensions?.GetExtensionParsedValue(oid);
+
+        public static Asn1OctetString GetExtensionValue(X509Extensions extensions, DerObjectIdentifier oid) =>
+            extensions?.GetExtensionValue(oid);
 
 		public static X509Extensions GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
         {
@@ -316,10 +315,8 @@ namespace Org.BouncyCastle.Asn1.X509
          *
          * @return the extension if it's present, null otherwise.
          */
-        public X509Extension GetExtension(DerObjectIdentifier oid)
-        {
-            return CollectionUtilities.GetValueOrNull(m_extensions, oid);
-        }
+        public X509Extension GetExtension(DerObjectIdentifier oid) =>
+            CollectionUtilities.GetValueOrNull(m_extensions, oid);
 
         /**
          * return the parsed value of the extension represented by the object identifier
@@ -327,10 +324,9 @@ namespace Org.BouncyCastle.Asn1.X509
          *
          * @return the parsed value of the extension if it's present, null otherwise.
          */
-        public Asn1Encodable GetExtensionParsedValue(DerObjectIdentifier oid)
-        {
-            return GetExtension(oid)?.GetParsedValue();
-        }
+        public Asn1Object GetExtensionParsedValue(DerObjectIdentifier oid) => GetExtension(oid)?.GetParsedValue();
+
+        public Asn1OctetString GetExtensionValue(DerObjectIdentifier oid) => GetExtension(oid)?.Value;
 
 		/**
 		 * <pre>
diff --git a/crypto/src/tsp/TimeStampRequest.cs b/crypto/src/tsp/TimeStampRequest.cs
index 2cef1ae94..8acf9367f 100644
--- a/crypto/src/tsp/TimeStampRequest.cs
+++ b/crypto/src/tsp/TimeStampRequest.cs
@@ -152,8 +152,6 @@ namespace Org.BouncyCastle.Tsp
 
 		public virtual bool HasExtensions => Extensions != null;
 
-		public virtual X509Extension GetExtension(DerObjectIdentifier oid) => Extensions?.GetExtension(oid);
-
 		public virtual IList<DerObjectIdentifier> GetExtensionOids() => TspUtil.GetExtensionOids(Extensions);
 
 		protected override X509Extensions GetX509Extensions() => Extensions;
diff --git a/crypto/src/x509/X509ExtensionBase.cs b/crypto/src/x509/X509ExtensionBase.cs
index d9df364b0..8cc805165 100644
--- a/crypto/src/x509/X509ExtensionBase.cs
+++ b/crypto/src/x509/X509ExtensionBase.cs
@@ -47,9 +47,13 @@ namespace Org.BouncyCastle.X509
 			return GetExtensionOids(true);
 		}
 
-		public virtual Asn1OctetString GetExtensionValue(DerObjectIdentifier oid)
-		{
-			return GetX509Extensions()?.GetExtension(oid)?.Value;
-		}
-	}
+        public virtual X509Extension GetExtension(DerObjectIdentifier oid) =>
+            GetX509Extensions()?.GetExtension(oid);
+
+        public virtual Asn1Object GetExtensionParsedValue(DerObjectIdentifier oid) =>
+            GetX509Extensions()?.GetExtensionParsedValue(oid);
+
+        public virtual Asn1OctetString GetExtensionValue(DerObjectIdentifier oid) =>
+            GetX509Extensions()?.GetExtensionValue(oid);
+    }
 }