[Botan-devel] types

wurzin wurzin at ywave.com
Thu Mar 24 17:06:34 EST 2005

Jack Lloyd wrote:
>>Now I can rewrite the lines as follows:
>>SymmetricKey key=kdf->derive_key(20,(const MemoryRegion<byte> 
>>&)master_key,"cipher key");
> You'll want to use master_key.bits_of(); what you're doing probably works on
> some compilers in the current versions, but it's fragile.
>>This seems to work, but I don't know how to reference the resultant key 
>>to print out its contents for verification that it's not just using a 
>>pointer value rather than a real key.  Could you give me a run down of 
>>the various types and there corrosponding underlying type and show me a 
>>way to print out there respective contents, and possibly a method to 
>>convert one type to another?
> SymmetricKey is basically a wrapper around SecureVector<byte> with some
> additional helper functions. To print out the key, SymmetricKey has a function
> as_string() which will return the hex value.
> The conversions between these works as follows:
> SecureVector<byte> bits = some_key.bits_of();
> SymmetricKey new_key(bits);
> -Jack

Thanks for the response. :)

I however realized libgm which is used by Botan is licenced by the LGPL 
which precludes it, and anything which uses it to be statically linked 
with a commercial product.  The nature of encryption and the reasons for 
its use sort of demand that the library be statically linked in or some 
nefarious individual could make a version of the shared library on their 
own system with bogus functions that would reveal everything about (keys 
et all) the encryption being used in whatever programs that link to it.

As a result I've been looking at openssl and I have to say your library 
is exceedingly more elegant and intuitive.  I consider myself most 
unfortunate in that I will not be able to use it.

More information about the botan-devel mailing list