code: function _fillMissingFields(attrs) {
    var attr;
    for(var i = 0; i < attrs.length; ++i) {
      attr = attrs[i];
  
      // populate missing name
      if(typeof attr.name === 'undefined') {
        if(attr.type && attr.type in pki.oids) {
          attr.name = pki.oids[attr.type];
        } else if(attr.shortName && attr.shortName in _shortNames) {
          attr.name = pki.oids[_shortNames[attr.shortName]];
        }
      }
  
      // populate missing type (OID)
      if(typeof attr.type === 'undefined') {
        if(attr.name && attr.name in pki.oids) {
          attr.type = pki.oids[attr.name];
        } else {
          var error = new Error('Attribute type not specified.');
          error.attribute = attr;
          throw error;
        }
      }
  
      // populate missing shortname
      if(typeof attr.shortName === 'undefined') {
        if(attr.name && attr.name in _shortNames) {
          attr.shortName = _shortNames[attr.name];
        }
      }
  
      // convert extensions to value
      if(attr.type === oids.extensionRequest) {
        attr.valueConstructed = true;
        attr.valueTagClass = asn1.Type.SEQUENCE;
        if(!attr.value && attr.extensions) {
          attr.value = [];
          for(var ei = 0; ei < attr.extensions.length; ++ei) {
            attr.value.push(pki.certificateExtensionToAsn1(
              _fillMissingExtensionFields(attr.extensions[ei])));
          }
        }
      }
  
      if(typeof attr.value === 'undefined') {
        var error = new Error('Attribute value not specified.');
        error.attribute = attr;
        throw error;
      }
    }
  }
docs: Fills in missing fields in attributes.
  
  @param attrs the attributes to fill missing fields in.