1 files changed, 17 insertions, 22 deletions
diff --git a/crypto/src/asn1/x509/AttributeTable.cs b/crypto/src/asn1/x509/AttributeTable.cs
index 71c42872e..eeee88fd7 100644
--- a/crypto/src/asn1/x509/AttributeTable.cs
+++ b/crypto/src/asn1/x509/AttributeTable.cs
@@ -1,55 +1,50 @@
-using System;
-using System.Collections;
+using System.Collections.Generic;
-using Org.BouncyCastle.Utilities;
+using Org.BouncyCastle.Utilities.Collections;
namespace Org.BouncyCastle.Asn1.X509
{
public class AttributeTable
{
- private readonly IDictionary attributes;
+ private readonly IDictionary<DerObjectIdentifier, AttributeX509> m_attributes;
- public AttributeTable(
- IDictionary attrs)
+ public AttributeTable(IDictionary<DerObjectIdentifier, AttributeX509> attrs)
{
- this.attributes = Platform.CreateHashtable(attrs);
+ m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(attrs);
}
- public AttributeTable(
- Asn1EncodableVector v)
+ public AttributeTable(Asn1EncodableVector v)
{
- this.attributes = Platform.CreateHashtable(v.Count);
+ m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(v.Count);
- for (int i = 0; i != v.Count; i++)
+ for (int i = 0; i != v.Count; i++)
{
AttributeX509 a = AttributeX509.GetInstance(v[i]);
- attributes.Add(a.AttrType, a);
+ m_attributes.Add(a.AttrType, a);
}
}
- public AttributeTable(
- Asn1Set s)
+ public AttributeTable(Asn1Set s)
{
- this.attributes = Platform.CreateHashtable(s.Count);
+ m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(s.Count);
- for (int i = 0; i != s.Count; i++)
+ for (int i = 0; i != s.Count; i++)
{
AttributeX509 a = AttributeX509.GetInstance(s[i]);
- attributes.Add(a.AttrType, a);
+ m_attributes.Add(a.AttrType, a);
}
}
- public AttributeX509 Get(
- DerObjectIdentifier oid)
+ public AttributeX509 Get(DerObjectIdentifier oid)
{
- return (AttributeX509) attributes[oid];
+ return CollectionUtilities.GetValueOrNull(m_attributes, oid);
}
- public IDictionary ToDictionary()
+ public IDictionary<DerObjectIdentifier, AttributeX509> ToDictionary()
{
- return Platform.CreateHashtable(attributes);
+ return new Dictionary<DerObjectIdentifier, AttributeX509>(m_attributes);
}
}
}
|