Pkcs12Entry
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.Pkcs;
using Org.BouncyCastle.Utilities.Collections;
using System.Collections.Generic;
namespace Org.BouncyCastle.Pkcs
{
public abstract class Pkcs12Entry
{
private readonly IDictionary<DerObjectIdentifier, Asn1Encodable> m_attributes;
public Asn1Encodable this[DerObjectIdentifier oid] {
get {
return CollectionUtilities.GetValueOrNull(m_attributes, oid);
}
}
public IEnumerable<DerObjectIdentifier> BagAttributeKeys => CollectionUtilities.Proxy(m_attributes.Keys);
public bool HasFriendlyName => m_attributes.ContainsKey(PkcsObjectIdentifiers.Pkcs9AtFriendlyName);
protected internal Pkcs12Entry(IDictionary<DerObjectIdentifier, Asn1Encodable> attributes)
{
m_attributes = attributes;
}
public void SetFriendlyName(string friendlyName)
{
m_attributes[PkcsObjectIdentifiers.Pkcs9AtFriendlyName] = new DerBmpString(friendlyName);
}
public bool TryGetAttribute(DerObjectIdentifier oid, out Asn1Encodable attribute)
{
return m_attributes.TryGetValue(oid, out attribute);
}
}
}