>From: owner-openssl-us...@openssl.org On Behalf Of Julian Melzig
>Sent: Monday, 08 April, 2013 01:50

>In C I have to make a Diffie-Hellman Key Exchange and the problem is 
>that the corresponding Java Server expects a ASN.1 DER encoded 
>SubjectPublicKeyInfo, the same thing that Java creates with the 
>getEncoded() Method, described here Click
><http://docs.oracle.com/javase/1.5.0/docs/api/java/security/Key.html> 

Aside: (Suncle) java 5 has been obsolete for years, and 6 officially 
is just recently. But this particular feature hasn't changed.

>and I have tried many things but I seem to misunderstand something. 
>I am at the point that I generated the Keys already and have an 
>DH object, but I also used the EVP Api and can have access to a 
>EVP_PKEY Object, that contains the parameters and y. 

>From EVP_PKEY encode to memory with i2d_PUBKEY and you can 
then write to a file or send over a connection or whatever;
or encode directly to a C FILE* with i2d_PUBKEY_fp, or to a 
BIO* with i2d_PUBKEY_bio; the BIO* can go to a file or socket 
or (autoalloc) memory, or something else you create.

Note for RSA DSA EC there are also "low-level" routines 
which take the algorithm-specific structure, but not DH.

>I think this is what I need, but how can i create that so that the 
>Java Server can handle it?


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to