package org.bouncycastle.cms;

/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
public class DefaultSignedAttributeTableGenerator implements org.bouncycastle.cms.CMSAttributeTableGenerator {
    private final java.util.Hashtable a;

    private static java.util.Hashtable b(java.util.Hashtable hashtable) {
        java.util.Hashtable hashtable2 = new java.util.Hashtable();
        java.util.Enumeration enumerationKeys = hashtable.keys();
        while (enumerationKeys.hasMoreElements()) {
            java.lang.Object objNextElement = enumerationKeys.nextElement();
            hashtable2.put(objNextElement, hashtable.get(objNextElement));
        }
        return hashtable2;
    }

    @Override // org.bouncycastle.cms.CMSAttributeTableGenerator
    public org.bouncycastle.asn1.cms.AttributeTable a(java.util.Map map) {
        return new org.bouncycastle.asn1.cms.AttributeTable(c(map));
    }

    protected java.util.Hashtable c(java.util.Map map) {
        org.bouncycastle.asn1.ASN1ObjectIdentifier aSN1ObjectIdentifierD;
        java.util.Hashtable hashtableB = b(this.a);
        org.bouncycastle.asn1.ASN1ObjectIdentifier aSN1ObjectIdentifier = org.bouncycastle.asn1.cms.CMSAttributes.a;
        if (!hashtableB.containsKey(aSN1ObjectIdentifier) && (aSN1ObjectIdentifierD = org.bouncycastle.asn1.ASN1ObjectIdentifier.D(map.get("contentType"))) != null) {
            org.bouncycastle.asn1.cms.Attribute attribute = new org.bouncycastle.asn1.cms.Attribute(aSN1ObjectIdentifier, new org.bouncycastle.asn1.DERSet(aSN1ObjectIdentifierD));
            hashtableB.put(attribute.n(), attribute);
        }
        org.bouncycastle.asn1.ASN1ObjectIdentifier aSN1ObjectIdentifier2 = org.bouncycastle.asn1.cms.CMSAttributes.c;
        if (!hashtableB.containsKey(aSN1ObjectIdentifier2)) {
            org.bouncycastle.asn1.cms.Attribute attribute2 = new org.bouncycastle.asn1.cms.Attribute(aSN1ObjectIdentifier2, new org.bouncycastle.asn1.DERSet(new org.bouncycastle.asn1.cms.Time(new java.util.Date())));
            hashtableB.put(attribute2.n(), attribute2);
        }
        org.bouncycastle.asn1.ASN1ObjectIdentifier aSN1ObjectIdentifier3 = org.bouncycastle.asn1.cms.CMSAttributes.b;
        if (!hashtableB.containsKey(aSN1ObjectIdentifier3)) {
            org.bouncycastle.asn1.cms.Attribute attribute3 = new org.bouncycastle.asn1.cms.Attribute(aSN1ObjectIdentifier3, new org.bouncycastle.asn1.DERSet(new org.bouncycastle.asn1.DEROctetString((byte[]) map.get("digest"))));
            hashtableB.put(attribute3.n(), attribute3);
        }
        org.bouncycastle.asn1.ASN1ObjectIdentifier aSN1ObjectIdentifier4 = org.bouncycastle.asn1.cms.CMSAttributes.g;
        if (!hashtableB.contains(aSN1ObjectIdentifier4)) {
            org.bouncycastle.asn1.cms.Attribute attribute4 = new org.bouncycastle.asn1.cms.Attribute(aSN1ObjectIdentifier4, new org.bouncycastle.asn1.DERSet(new org.bouncycastle.asn1.cms.CMSAlgorithmProtection((org.bouncycastle.asn1.x509.AlgorithmIdentifier) map.get("digestAlgID"), 1, (org.bouncycastle.asn1.x509.AlgorithmIdentifier) map.get("signatureAlgID"))));
            hashtableB.put(attribute4.n(), attribute4);
        }
        return hashtableB;
    }
}
