[Botan-devel] Botan: Decoding error: X.509 public key decoding failed

Jack Lloyd lloyd at randombit.net
Thu Feb 3 21:44:52 EST 2011


There is nothing obvious here, but perhaps examining the contents
of the second file will provide some clues? -Jack


On Thu, Feb 03, 2011 at 06:09:34PM -0800, William K. Foster wrote:
> Hello,
> 
> I am having trouble calling some code a second time.  The first time all
> works great, but if I repeat I get an error:
> 
>     Botan: Decoding error: X.509 public key decoding failed
> 
> Stack is:
> 
> #0  0x0076afe1 in __cxa_throw () from /usr/lib/libstdc++.so.6
> #1  0x082fde8d in Botan::PEM_Code::decode(Botan::DataSource&,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) ()
> #2  0x082fe687 in Botan::PEM_Code::decode_check_label(Botan::DataSource&,
> std::basic_string<char, std::char_traits<char>, std::allocator<char> >
> const&) ()
> #3  0x082c554f in Botan::X509::load_key(Botan::DataSource&) ()
> #4  0x082c62ad in Botan::X509::load_key(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&) ()
> #5  0x0818dfdd in CipherDH::getDHPublicKey (this=0xbfffa5e4, cpkt=...) at
> utl.cpp:637
> 
> const DH_PublicKey * // private
> CipherDH::getDHPublicKey(const CPacket &cpkt)
> {
>   const string publicKey(cpkt.getDataAsString(), cpkt.getDataSz());
>   const string tempFile = sdsTempFileName("publicKeyDH");
>   {
>     sdsfio publicKeyFile;
> 
>     if (!publicKeyFile.open(tempFile, "w")) {
>       throw sdsErr(publicKeyFile.errornumber(),
>                    "Failed to open many key file '" + tempFile +
>                    "' for writing",
>                    __PRETTY_FUNCTION__, __FILE__, __LINE__);
>     }
>     publicKeyFile.writeString(publicKey);
>   }
>   const X509_PublicKey *key = load_key(tempFile);
> ...
> }
> 
> Why does this only work once?  How can I reset things so that a second
> attempt works?
> 
> Thanks.
> 
> -William

> _______________________________________________
> botan-devel mailing list
> botan-devel at randombit.net
> http://lists.randombit.net/mailman/listinfo/botan-devel




More information about the botan-devel mailing list