Fork for poking around in the original "client implementation for p≡p update server".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

// this file is under GNU General Public License 3.0
// see LICENSE.txt
#include "downloadclient.hh"
#include <iostream>
#include <sstream>
namespace pEp {
namespace UpdateClient {
PublicKey load_key(string filename)
CryptoPP::RSA::PublicKey key;
std::ifstream ifs{filename, std::ios::binary};
CryptoPP::ByteQueue queue;
CryptoPP::FileSource file(ifs, true);
return key;
string update(product p, PublicKey update_key, notifyRead_t notifyRead)
UpdateStream us { UpdateDevice(p) };
try {
us->open(update_key, notifyRead);
catch (exception&) { }
if (us->filename() == "")
throw DownloadError();
return us->filename();
string update(product p, string keyfile, notifyRead_t notifyRead)
PublicKey update_key = load_key(keyfile);
return update(p, update_key, notifyRead);