pike.git / lib / modules / Standards.pmod / X509.pmod

version» Context lines:

pike.git/lib/modules/Standards.pmod/X509.pmod:388:    if (internal_der) return internal_der;    return internal_der = der_encode();    }       //!    void `version=(int v)    {    internal_der = UNDEFINED;    if (v == 1) {    if (sizeof(elements) > 6) { +  DBG("Reducing version to %d\n", v);    elements = elements[1..6];    issuer_pos = subject_pos = extensions_pos = 0; -  +  internal_extensions = ([]); +  internal_critical = (<>);    }    } else if (sizeof(elements) == 6) { -  +  DBG("Bumping version to %d\n", v);    elements = ({ version_integer(Integer(v-1)) }) + elements;    } else { -  +  if ((v < 3) && extensions_pos) { +  DBG("Reducing version to %d\n", v); +  elements = elements[..extensions_pos-1]; +  extensions_pos = 0; +  internal_extensions = ([]); +  internal_critical = (<>); +  } else { +  DBG("Bumping version to %d\n", v); +  }    elements[0] = version_integer(Integer(v-1));    }    }    int `version()    {    if (sizeof(elements) == 6) return 1;    return (int)elements[0][0]->value + 1;    }       //! @param index
pike.git/lib/modules/Standards.pmod/X509.pmod:641:       extensions[ id ] =    Standards.ASN1.Decode.simple_der_decode(ext->elements[-1]->value);    if(sizeof(ext)==3)    {    if( ext[1]->type_name != "BOOLEAN" ) return 0;    if( ext[1]->value ) critical[id]=1;    }    }    -  if (extensions_pos) { +  if (!extensions_pos) {    if (version < 3) version = 3;    extensions_pos = sizeof(elements);    elements = elements + ({ TaggedType3(r) });    } else {    elements[extensions_pos] = TaggedType3(r);    }       internal_extensions = extensions;    internal_critical = critical;    }
pike.git/lib/modules/Standards.pmod/X509.pmod:858:    issuer_id = BitString()->decode_primitive(a[i]->raw);    DBG("TBSCertificate: issuer_id = %O\n", issuer_id);    i++;    }    if ((i < sizeof(a)) && !a[i]->constructed &&    (a[i]->combined_tag == make_combined_tag(2, 2)))    {    subject_id = BitString()->decode_primitive(a[i]->raw);    DBG("TBSCertificate: subject_id = %O\n", subject_id);    i++; -  if (i == sizeof(a)) -  return this; +     }    }    if (version >= 3) {    if ((i < sizeof(a)) && a[i]->constructed &&    (a[i]->combined_tag == make_combined_tag(2, 3)) &&    sizeof(a[i])==1 &&    a[i][0]->type_name == "SEQUENCE") {    raw_extensions = a[i][0]; -  +  i++;    }    }    internal_der = asn1->get_der();    if (i == sizeof(a))    return this;    /* Too many fields */    return 0;    }   }