pike.git / lib / modules / Standards.pmod / ASN1.pmod / Types.pmod

version» Context lines:

pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:77:    return make_combined_tag(get_cls(), get_tag());    }       protected string(0..255)|zero der;       // Should be overridden by subclasses    this_program decode_primitive(string contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object) decoder, -  mapping(int:program(Object)) types); +  mapping(int:program(Object)) types, +  void|int(0..1) secure);    void begin_decode_constructed(string raw);    void decode_constructed_element(int i, object e);       mapping(int:program(Object)) element_types(int i,    mapping(int:program(Object)) types) {    return types; i;    }    this_program init(mixed ... args) { return this; args; }       protected string(0..255) to_base_128(int n)
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:232:    }       string(0..255) get_der_content() {    return [string(0..255)]value;    }       this_program decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    value = contents;    return this;    }       void begin_decode_constructed(string raw)    {    value = "";    }       void decode_constructed_element(int i, object(this_program) e)
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:282:    // While every non-zero value is true, the canonical true is 0xff.    string(0..255) get_der_content()    {    return value ? "\377" : "\0";    }       this_program decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    if( contents=="" ) error("Illegal boolean value.\n");    value = (contents != "\0");    return this;    }       protected string _sprintf(int t) {    return t=='O' && sprintf("%O(%s)", this_program, (value?"TRUE":"FALSE"));    }   }   
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:340:    s = "\0" + s;    }       return s;    }       this_object decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) { +  if( secure && sizeof(contents)>1 && contents[0]==0 ) +  error("Leading zero.");    value = Gmp.mpz(contents, 256);    if (contents[0] & 0x80) /* Negative */    value -= pow(256, sizeof(contents));    return this;    }       protected string _sprintf(int t) {    if(t!='O') return UNDEFINED;    if(!value) return sprintf("%O(0)", this_program);    return sprintf("%O(%d %s)", this_program,
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:398:    return "\x42";    }       error("Encoding Real values not supported.\n");    }       this_object decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object) decoder, -  mapping(int:program(Object))|void types) { -  if( contents=="" ) { value = 0.0; return this; } +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) { +  if( contents=="" ) { +  value = 0.0; +  return this; +  }    int(0..255) first = contents[0];    switch( first )    {    // SpecialRealValues    case 0b01000000: value = Math.inf; return this;    case 0b01000001: value = -Math.inf; return this;    case 0b01000010: value = Math.nan; return this;    case 0b01000011: value = -0.0; return this;       // ISO 6093
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:520:    unused = 0;    value = "";    }    return this;    }       this_program|zero decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    if (!sizeof(contents))    return 0;       if (contents[0] >= 8)    return 0;       unused = [int(0..7)]contents[0];    value = contents[1..];       // Unused bits should be zero. I can't find anything in X.690 that
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:599:   class Null   {    inherit Object;    int(0..) tag = 5;    constant type_name = "NULL";       this_program decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    return !sizeof(contents) && this;    }       array _encode()    {    return ({ cls, tag });    }       void _decode(array(int) x)    {
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:651:    {    return [string(0..255)]sprintf("%s%@s",    to_base_128(40 * id[0] + id[1]),    map(id[2..], to_base_128));    }       this_program decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    if (contents[0] < 120)    id = ({ contents[0] / 40, contents[0] % 40 });    else    id = ({ 2, contents[0] - 80 });    int index = 1;    while(index < sizeof(contents))    {    int element = 0;    do {    element = element << 7 | (contents[index] & 0x7f);
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:753:       string(0..255) get_der_content()    {    return string_to_utf8(value);    }       this_program|zero decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    der = contents;    if (catch {    value = utf8_to_string(contents);    })    return 0;       return this;    }   }   
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:783:    WERROR("ASN1.Sequence: elements = '%O\n", elements);    array(string) a = elements->get_der();    WERROR("ASN1.Sequence: der_encode(elements) = '%O\n", a);    return [string(0..255)]`+("", @ a);    }       this_program decode_primitive(string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object) decoder, -  mapping(int:program(Object)) types) { +  mapping(int:program(Object)) types, +  void|int(0..1) secure) {    der = contents;    elements = ({});    Stdio.Buffer data = Stdio.Buffer(contents);    while (sizeof(data)) {    elements += ({ decoder(data, types) });    }    return this;    }   }   
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:1016:    constant type_name = "UniversalString";       string get_der_content() {    error( "Encoding not implemented\n" );    }       this_program decode_primitive (string contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    error( "Decoding not implemented\n" ); contents;    }   }      //!   int(0..1) asn1_bmp_valid (string s)   {    return global.String.width(s)<32;   }   
pike.git/lib/modules/Standards.pmod/ASN1.pmod/Types.pmod:1047:    constant type_name = "BMPString";       string get_der_content() {    return string_to_unicode (value);    }       this_program decode_primitive (string(0..255) contents,    function(Stdio.Buffer,    mapping(int:program(Object)):    Object)|void decoder, -  mapping(int:program(Object))|void types) { +  mapping(int:program(Object))|void types, +  void|int(0..1) secure) {    der = contents;    value = unicode_to_string (contents);    return this;    }   }      //! Meta-instances handle a particular explicit tag and set of types.   //! Once cloned this object works as a factory for Compound objects   //! with the cls and tag that the meta object was initialized with.   //!