[Botan-devel] Casting a byte to a DH_PublicKey

Z. S. O. tiredashell at gmail.com
Sun Apr 12 12:51:55 EDT 2009

Nevermind, I figured it out myself. It turns out that you need to convert it
to a BigInt first (I'm not sure why I was trying to cast it to a
DH_PublicKey, that doesn't even make sense =), Here's the code in case
anyone is curious:
SecureVector<byte> my_public_key_bits = my_private_key.public_value();
BigInt pubKey = BigInt::decode(my_public_key_bits);
DH_PublicKey key(DL_Group("modp/ietf/1024"), pubKey);

On Sat, Apr 11, 2009 at 7:03 PM, Z. S. O. <tiredashell at gmail.com> wrote:

> Unfortunately I have another casting problem. I used a command similar to
> the following to get my DH_PublicKey in byte form:
> SecureVector<byte> my_public_key_bits = my_private_key.public_value();
> How would you convert this back into a DH_PublicKey? I tried using
> reinterpret_cast as before, but my compiler says that a SecureVector<byte>
> cannot be casted to it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20090412/bcfb25dd/attachment.html>

More information about the botan-devel mailing list