OK. I've found a way round this for those who are interested. Java
doesn't *have* to use X509 encoded public keys for DH KA.

So, the useful public method (of a DH object):

AccessGroupParameters (). DecodeElement ()

Comes in handy to get the public (Integer) y = g^x % p from the
SecByteBlock instance holding the encoded public key. We send that (y)
to the Java app. Java can then use this and the generator and modulus to
agree on the key later. 

There is a compliment to DecodeElement which is of course EncodeElement.
So you can get the Java app' y to the C++ program.

Thats it in a nutshell.

Regards

Jim Vanns

On Wed, 2005-04-13 at 12:46 +0100, James Vanns wrote:
> All,
> 
> I need to exchange DH public keys with a Java servlet. This servlet uses
> the Sun JCE provider for its crypto stuff. I'm obviously using Crypto++.
> 
> I can get the DH public key into a SecByteBlock using GenerateKeyPair
> (). However, Java encodes its DH public keys using the X.509
> SubjectPublicKeyInfo standard - as far as I can tell.
> 
> So, I need to do the same. Here is the question; how the hell do I get a
> DH public key encoded in the same format? 
> 
> I've trawled the doxygen manual and have found hints:
> 
> DEREncode () - what does this do exactly? Encode the entire 'this'
> object? Encode the public key only? If so does it comply to X.509
> SubjectPublicKeyInfo?
> 
> The inherited AccessMaterial or GetMaterial methods of a DH object. The
> X509PublicKey class - but this seems to be a pure virtual/abstract class
> so I can't instantiate it.
> 
> Any help would be gratefully appreciated!
> 
> Cheers,
> 
> Jim
> 
-- 
James Vanns BSc (Hons) MCP
Linux Systems Administrator
Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370


Reply via email to