On 19 March 2013 12:22, azhar jodatti <azhar...@gmail.com> wrote: > PEM_write_bio_DHparams(out, temp);//this prints public key in base64 > (this is what i think :) )
This is NOT a base64 representation of the public key. This is printing out the parameters only (which does not include the public key) > X509EncodedKeySpec x509KeySpec = new > X509EncodedKeySpec(clientPubKeyEnc); > PublicKey alicePubKey = bobKeyFac.generatePublic(x509KeySpec); // > this throws invalidKeySpecException : invalid key specification > Instead of above, try something like this: BigInteger y = new BigInteger("4373485839237796166699589228729451887524557806298817546317652313209684941935291316056752499275686842785989445002203537603465313281932431907074220666705812428468899520395399424699433568818334649395647035588736697462362131440308900155995886437558059484184376957451229991382889256903754886307405909744230582829"); BigInteger p = new BigInteger("106824077746282794452228647025839229808074839339760371103063155402464842614962676228255294325459053774613506891207056818441720848774298482866918174271328357364028843638451324415691330056638482781344307395975948664971732094293996189467599104442989563027727348339786810653279203313302815966250977426622843204103"); BigInteger g = new BigInteger("5"); DHPublicKeySpec dhKeySpec = new DHPublicKeySpec(y, p, g); PublicKey alicPubKey = bobKeyFac.generatePublic(dhKeySpec); Matt ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org