diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 21:11:59 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 21:11:59 +0700 |
commit | 35cfd51633bbbbc92c2c17c76646e9a9dc945b11 (patch) | |
tree | 563cda15bf08c63de832198be2b9e0263bae5e60 /crypto/src/asn1/cms/SignerInfo.cs | |
parent | Split up fast/slow tests (diff) | |
download | BouncyCastle.NET-ed25519-35cfd51633bbbbc92c2c17c76646e9a9dc945b11.tar.xz |
Generics migration in Asn1
Diffstat (limited to 'crypto/src/asn1/cms/SignerInfo.cs')
-rw-r--r-- | crypto/src/asn1/cms/SignerInfo.cs | 24 |
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 { |