code: function _decodeBagAttributes(attributes) {
    var decodedAttrs = {};
  
    if(attributes !== undefined) {
      for(var i = 0; i < attributes.length; ++i) {
        var capture = {};
        var errors = [];
        if(!asn1.validate(attributes[i], attributeValidator, capture, errors)) {
          var error = new Error('Cannot read PKCS#12 BagAttribute.');
          error.errors = errors;
          throw error;
        }
  
        var oid = asn1.derToOid(capture.oid);
        if(pki.oids[oid] === undefined) {
          // unsupported attribute type, ignore.
          continue;
        }
  
        decodedAttrs[pki.oids[oid]] = [];
        for(var j = 0; j < capture.values.length; ++j) {
          decodedAttrs[pki.oids[oid]].push(capture.values[j].value);
        }
      }
    }
  
    return decodedAttrs;
  }
docs: Decode PKCS#12 SET OF PKCS12Attribute into JavaScript object.
  
  @param attributes SET OF PKCS12Attribute (ASN.1 object).
  
  @return the decoded attributes.