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/x9 | |
parent | Split up fast/slow tests (diff) | |
download | BouncyCastle.NET-ed25519-35cfd51633bbbbc92c2c17c76646e9a9dc945b11.tar.xz |
Generics migration in Asn1
Diffstat (limited to 'crypto/src/asn1/x9')
-rw-r--r-- | crypto/src/asn1/x9/DHDomainParameters.cs | 6 | ||||
-rw-r--r-- | crypto/src/asn1/x9/KeySpecificInfo.cs | 7 | ||||
-rw-r--r-- | crypto/src/asn1/x9/OtherInfo.cs | 15 |
3 files changed, 11 insertions, 17 deletions
diff --git a/crypto/src/asn1/x9/DHDomainParameters.cs b/crypto/src/asn1/x9/DHDomainParameters.cs index a92322717..0439b28cd 100644 --- a/crypto/src/asn1/x9/DHDomainParameters.cs +++ b/crypto/src/asn1/x9/DHDomainParameters.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Org.BouncyCastle.Utilities; @@ -49,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.X9 if (seq.Count < 3 || seq.Count > 5) throw new ArgumentException("Bad sequence size: " + seq.Count, "seq"); - IEnumerator e = seq.GetEnumerator(); + var e = seq.GetEnumerator(); this.p = DerInteger.GetInstance(GetNext(e)); this.g = DerInteger.GetInstance(GetNext(e)); this.q = DerInteger.GetInstance(GetNext(e)); @@ -68,7 +68,7 @@ namespace Org.BouncyCastle.Asn1.X9 } } - private static Asn1Encodable GetNext(IEnumerator e) + private static Asn1Encodable GetNext(IEnumerator<Asn1Encodable> e) { return e.MoveNext() ? (Asn1Encodable)e.Current : null; } diff --git a/crypto/src/asn1/x9/KeySpecificInfo.cs b/crypto/src/asn1/x9/KeySpecificInfo.cs index 46298646b..8e5fb9ea7 100644 --- a/crypto/src/asn1/x9/KeySpecificInfo.cs +++ b/crypto/src/asn1/x9/KeySpecificInfo.cs @@ -1,5 +1,3 @@ -using System.Collections; - namespace Org.BouncyCastle.Asn1.X9 { /** @@ -20,10 +18,9 @@ namespace Org.BouncyCastle.Asn1.X9 this.counter = counter; } - public KeySpecificInfo( - Asn1Sequence seq) + public KeySpecificInfo(Asn1Sequence seq) { - IEnumerator e = seq.GetEnumerator(); + var e = seq.GetEnumerator(); e.MoveNext(); algorithm = (DerObjectIdentifier)e.Current; diff --git a/crypto/src/asn1/x9/OtherInfo.cs b/crypto/src/asn1/x9/OtherInfo.cs index 4a52b7206..c1819a5ee 100644 --- a/crypto/src/asn1/x9/OtherInfo.cs +++ b/crypto/src/asn1/x9/OtherInfo.cs @@ -1,5 +1,3 @@ -using System.Collections; - namespace Org.BouncyCastle.Asn1.X9 { /** @@ -23,25 +21,24 @@ namespace Org.BouncyCastle.Asn1.X9 this.suppPubInfo = suppPubInfo; } - public OtherInfo( - Asn1Sequence seq) + public OtherInfo(Asn1Sequence seq) { - IEnumerator e = seq.GetEnumerator(); + var e = seq.GetEnumerator(); e.MoveNext(); - keyInfo = new KeySpecificInfo((Asn1Sequence) e.Current); + keyInfo = new KeySpecificInfo((Asn1Sequence)e.Current); while (e.MoveNext()) { - DerTaggedObject o = (DerTaggedObject) e.Current; + Asn1TaggedObject o = (Asn1TaggedObject)e.Current; if (o.TagNo == 0) { - partyAInfo = (Asn1OctetString) o.GetObject(); + partyAInfo = (Asn1OctetString)o.GetObject(); } else if ((int) o.TagNo == 2) { - suppPubInfo = (Asn1OctetString) o.GetObject(); + suppPubInfo = (Asn1OctetString)o.GetObject(); } } } |