diff options
Diffstat (limited to 'crypto/src/asn1/esf/SignerLocation.cs')
-rw-r--r-- | crypto/src/asn1/esf/SignerLocation.cs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/crypto/src/asn1/esf/SignerLocation.cs b/crypto/src/asn1/esf/SignerLocation.cs index 0e87812be..106a32c59 100644 --- a/crypto/src/asn1/esf/SignerLocation.cs +++ b/crypto/src/asn1/esf/SignerLocation.cs @@ -19,9 +19,9 @@ namespace Org.BouncyCastle.Asn1.Esf public class SignerLocation : Asn1Encodable { - private DirectoryString countryName; - private DirectoryString localityName; - private Asn1Sequence postalAddress; + private readonly DirectoryString countryName; + private readonly DirectoryString localityName; + private readonly Asn1Sequence postalAddress; public SignerLocation(Asn1Sequence seq) { @@ -99,13 +99,7 @@ namespace Org.BouncyCastle.Asn1.Esf if (postalAddress == null) return null; - DirectoryString[] dirStrings = new DirectoryString[postalAddress.Count]; - for (int i = 0; i != dirStrings.Length; i++) - { - dirStrings[i] = DirectoryString.GetInstance(postalAddress[i]); - } - - return dirStrings; + return postalAddress.MapElements(element => DirectoryString.GetInstance(element.ToAsn1Object())); } public Asn1Sequence PostalAddress @@ -132,7 +126,7 @@ namespace Org.BouncyCastle.Asn1.Esf */ public override Asn1Object ToAsn1Object() { - Asn1EncodableVector v = new Asn1EncodableVector(); + Asn1EncodableVector v = new Asn1EncodableVector(3); v.AddOptionalTagged(true, 0, countryName); v.AddOptionalTagged(true, 1, localityName); v.AddOptionalTagged(true, 2, postalAddress); |