[Botan-devel] Converting SecureVector<byte> to string

Z. S. O. tiredashell at gmail.com
Sat Mar 28 15:07:06 EDT 2009


That seems to work well, but it's not clear to me how to go the other
direction (string to SecureVector<byte>) since a byte is smaller than a char
so the compiler keeps yelling at me for losing precision.

On Fri, Mar 27, 2009 at 8:50 PM, Jack Lloyd <lloyd at randombit.net> wrote:

> On Fri, Mar 27, 2009 at 05:33:39PM -0400, Z. S. O. wrote:
> > My current method of converting a SecureVector<byte> to a string is put
> it
> > in a pipe with the Base64_Encoder filter. To go the other direction, I
> pipe
> > it with Base64_Decoder. I've decided, however, that I don't want to
> encode
> > it in any readable format; I'd like the raw binary data. Is there a
> simple
> > way to do this?
>
> All you should need for this is
>
> std::string s(reinterpret_cast<const char*>(memvec.begin()),
>              memvec.size());
>
> -Jack
> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20090328/456ae14a/attachment.html>


More information about the botan-devel mailing list