pike.git / lib / modules / SSL.pmod / asn1.pmod.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/asn1.pmod.pike:1:   /* asn1.pmod.pike    *    * Rudimentary support for decoding ASN.1 encoded data.    * -  * $Id: asn1.pmod.pike,v 1.1 1997/03/15 04:46:01 nisse Exp $ +  * $Id: asn1.pmod.pike,v 1.2 1997/03/15 07:10:53 nisse Exp $    */      /* BER decoder    *    * Values are represented as arrays ({ tag, value }).    * Tag is either an integer tag number, or a string, in case    * the tag recognized.    *    * Values are strings, integers, or arrays */   
pike.git/lib/modules/SSL.pmod/asn1.pmod.pike:65:    case 4: /* Octet string */    tag = "OCTET STRING";    break;    case 5: /* Null */    if (strlen(contents))    throw( ({ "SSL.asn1: Invalid NULL value.\n", backtrace() }) );    break;    case 6: /* Object id */    {    tag = "Identifier"; -  if (value[0] <= 2) +  if (contents[0] < 120)    value = ({ contents[0] / 40, contents[0] % 40 });    else    value = ({ 2, contents[0] - 80 });    int index = 1;    while(index < strlen(contents))    {    int id = 0;    do    {    id = id << 7 | (contents[index] & 0x7f);