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

William K. Foster wkf at alum.mit.edu
Thu Feb 3 21:09:34 EST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20110203/9d93dfb2/attachment.html>


More information about the botan-devel mailing list