Hi, developers!

While trying to understand the ASN.1 stuff I wrote the following lines:

        ASN1_INTEGER * pInt, * qInt;
        unsigned char buf[1024], *cPtr;
        int l, p, q;

        p = -2;
        pInt = ASN1_INTEGER_new();
        ASN1_INTEGER_set(pInt, p);
        cPtr = buf;
        i2d_ASN1_INTEGER(pInt, &cPtr);  // DER encode p
        l = (cPtr - buf);
        cPtr = buf;
        qInt = d2i_ASN1_INTEGER(NULL, &cPtr, l);        // DER decode q
        q = ASN1_INTEGER_get(qInt);

        printf("p = %d  q = %d\n", p, q);


why is q = -32770 ???? and not -2 ?

Robert

---------------------------------------------
Robert Eiglmaier
iXOS Software AG
Tel 089/4629-1526
Fax 089/4629-331526


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to