summary refs log tree commit diff
path: root/crypto/src/asn1/cms/SignerInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms/SignerInfo.cs')
-rw-r--r--crypto/src/asn1/cms/SignerInfo.cs24
1 files changed, 11 insertions, 13 deletions
diff --git a/crypto/src/asn1/cms/SignerInfo.cs b/crypto/src/asn1/cms/SignerInfo.cs
index 82ed04082..dbd0125c4 100644
--- a/crypto/src/asn1/cms/SignerInfo.cs
+++ b/crypto/src/asn1/cms/SignerInfo.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Collections;
 
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Utilities;
@@ -17,8 +16,7 @@ namespace Org.BouncyCastle.Asn1.Cms
         private Asn1OctetString         encryptedDigest;
         private Asn1Set                 unauthenticatedAttributes;
 
-        public static SignerInfo GetInstance(
-            object obj)
+        public static SignerInfo GetInstance(object obj)
         {
             if (obj == null || obj is SignerInfo)
                 return (SignerInfo) obj;
@@ -65,26 +63,26 @@ namespace Org.BouncyCastle.Asn1.Cms
 
         private SignerInfo(Asn1Sequence seq)
         {
-            IEnumerator e = seq.GetEnumerator();
+            var e = seq.GetEnumerator();
 
             e.MoveNext();
-            version = (DerInteger) e.Current;
+            version = (DerInteger)e.Current;
 
             e.MoveNext();
-            sid = SignerIdentifier.GetInstance(e.Current);
+            sid = SignerIdentifier.GetInstance(e.Current.ToAsn1Object());
 
             e.MoveNext();
-            digAlgorithm = AlgorithmIdentifier.GetInstance(e.Current);
+            digAlgorithm = AlgorithmIdentifier.GetInstance(e.Current.ToAsn1Object());
 
             e.MoveNext();
-            object obj = e.Current;
+            var obj = e.Current.ToAsn1Object();
 
-            if (obj is Asn1TaggedObject)
+            if (obj is Asn1TaggedObject tagged)
             {
-                authenticatedAttributes = Asn1Set.GetInstance((Asn1TaggedObject) obj, false);
+                authenticatedAttributes = Asn1Set.GetInstance(tagged, false);
 
                 e.MoveNext();
-                digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(e.Current);
+                digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(e.Current.ToAsn1Object());
             }
             else
             {
@@ -93,11 +91,11 @@ namespace Org.BouncyCastle.Asn1.Cms
             }
 
             e.MoveNext();
-            encryptedDigest = DerOctetString.GetInstance(e.Current);
+            encryptedDigest = Asn1OctetString.GetInstance(e.Current.ToAsn1Object());
 
             if (e.MoveNext())
             {
-                unauthenticatedAttributes = Asn1Set.GetInstance((Asn1TaggedObject) e.Current, false);
+                unauthenticatedAttributes = Asn1Set.GetInstance((Asn1TaggedObject)e.Current.ToAsn1Object(), false);
             }
             else
             {