init commit

This commit is contained in:
2025-10-09 09:57:24 +09:00
commit 4d551bd74f
6636 changed files with 1218703 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Utilities.Collections;
namespace Org.BouncyCastle.Pkcs;
public abstract class Pkcs12Entry
{
private readonly IDictionary attributes;
public Asn1Encodable this[DerObjectIdentifier oid] => (Asn1Encodable)attributes[oid.Id];
public Asn1Encodable this[string oid] => (Asn1Encodable)attributes[oid];
public IEnumerable BagAttributeKeys => new EnumerableProxy(attributes.Keys);
protected internal Pkcs12Entry(IDictionary attributes)
{
this.attributes = attributes;
foreach (object attribute in attributes)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)attribute;
if (!(dictionaryEntry.Key is string))
{
throw new ArgumentException("Attribute keys must be of type: " + typeof(string).FullName, "attributes");
}
if (!(dictionaryEntry.Value is Asn1Encodable))
{
throw new ArgumentException("Attribute values must be of type: " + typeof(Asn1Encodable).FullName, "attributes");
}
}
}
[Obsolete("Use 'object[index]' syntax instead")]
public Asn1Encodable GetBagAttribute(DerObjectIdentifier oid)
{
return (Asn1Encodable)attributes[oid.Id];
}
[Obsolete("Use 'object[index]' syntax instead")]
public Asn1Encodable GetBagAttribute(string oid)
{
return (Asn1Encodable)attributes[oid];
}
[Obsolete("Use 'BagAttributeKeys' property")]
public IEnumerator GetBagAttributeKeys()
{
return attributes.Keys.GetEnumerator();
}
}