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/esf | |
parent | Split up fast/slow tests (diff) | |
download | BouncyCastle.NET-ed25519-35cfd51633bbbbc92c2c17c76646e9a9dc945b11.tar.xz |
Generics migration in Asn1
Diffstat (limited to 'crypto/src/asn1/esf')
-rw-r--r-- | crypto/src/asn1/esf/SignerLocation.cs | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/crypto/src/asn1/esf/SignerLocation.cs b/crypto/src/asn1/esf/SignerLocation.cs index 4c82d09fd..0e87812be 100644 --- a/crypto/src/asn1/esf/SignerLocation.cs +++ b/crypto/src/asn1/esf/SignerLocation.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using Org.BouncyCastle.Asn1.X500; @@ -24,27 +23,26 @@ namespace Org.BouncyCastle.Asn1.Esf private DirectoryString localityName; private Asn1Sequence postalAddress; - public SignerLocation( - Asn1Sequence seq) + public SignerLocation(Asn1Sequence seq) { foreach (Asn1TaggedObject obj in seq) { switch (obj.TagNo) { - case 0: - this.countryName = DirectoryString.GetInstance(obj, true); - break; - case 1: - this.localityName = DirectoryString.GetInstance(obj, true); - break; - case 2: - bool isExplicit = obj.IsExplicit(); // handle erroneous implicitly tagged sequences - this.postalAddress = Asn1Sequence.GetInstance(obj, isExplicit); - if (postalAddress != null && postalAddress.Count > 6) - throw new ArgumentException("postal address must contain less than 6 strings"); - break; - default: - throw new ArgumentException("illegal tag"); + case 0: + this.countryName = DirectoryString.GetInstance(obj, true); + break; + case 1: + this.localityName = DirectoryString.GetInstance(obj, true); + break; + case 2: + bool isExplicit = obj.IsExplicit(); // handle erroneous implicitly tagged sequences + this.postalAddress = Asn1Sequence.GetInstance(obj, isExplicit); + if (postalAddress != null && postalAddress.Count > 6) + throw new ArgumentException("postal address must contain less than 6 strings"); + break; + default: + throw new ArgumentException("illegal tag"); } } } @@ -78,13 +76,10 @@ namespace Org.BouncyCastle.Asn1.Esf { } - public static SignerLocation GetInstance( - object obj) + public static SignerLocation GetInstance(object obj) { if (obj == null || obj is SignerLocation) - { return (SignerLocation) obj; - } return new SignerLocation(Asn1Sequence.GetInstance(obj)); } |