Hello, It would be very great if my problem could be solved here. 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) 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.
I found in other thread the following explanation: " X509EncodedKeySpec is correct if you have a DH public key (or other public key) *in X.509 SubjectPublicKeyInfo format* which Openssl calls PUBKEY and can do with no additional code." Thread (http://www.mail-archive.com/openssl-users@openssl.org/msg70568.html) I think this is what I need, but how can i create that so that the Java Server can handle it?