Tyler Durden wrote:
Hellos, I have some problems with the function  i2d_DSA_PUBKEY.
I want serialize the public key to send this to a client Java for this
can read this public key.
I get serialize with openSSL, but the Java client throw an exception
of the bad encoded when read this.
Java have some functions to read PCS8 enconded key and x509 encoded key.

On the oder hand, I don't understand beccause I have allocate memory
in the second parameter of the function i2d_DSA_PUBKEY if this is a
pointer to pointer of the unsigned char threrefore the function can
allocate memory in the pointer else why the parameter is a double
pointer?
...
    unsigned char *pubKeyInterchange = new unsigned char[1024];
    int pubKeyInchgSize = 0;
    pubKeyInchgSize = i2d_DSA_PUBKEY( dsa, &pubKeyInterchange );

    if( !writeFile( "pubkey.txt", pubKeyInterchange, pubKeyInchgSize ) )
    {
        std::cout << "writeFile( .. ) error" << std::endl;
        return -8;
    }

read the FAQ entry "How do I read or write a DER encoded buffer using the ASN1 functions?"


Nils
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to