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.
 
 
 
downloadclient/downloadclient.hh

59 lines
1.8 KiB

// this file is under GNU General Public License 3.0
// see LICENSE.txt
#pragma once
#include <iostream>
#include "UpdateStream.hh"
namespace pEp {
namespace UpdateClient {
using namespace std;
struct DownloadError : runtime_error {
DownloadError() : runtime_error("download not possible") { }
};
// load_key() - load BER encoded RSA public key
//
// params:
// filename (in) keyfile to load from
//
// returns:
// CryptoPP::RSA::PublicKey
//
// throws:
// CannotLoadKey if key cannot be loaded
PublicKey load_key(string filename);
// update() - download update for a product if available
//
// params:
// p (in) product to update with:
// name (in) product name
// url (in) download URL with GET param:
// hash serial number
// update_key (in) Update Key as CryptoPP::RSA::PublicKey
// notifyRead (in) notified on read
//
// returns:
// filename of downloaded file
//
// throws:
// DownloadError if no new update could be downloaded
//
// caveat:
// this function is using the current directory to download
// therefore, the current directory has to be writable
//
// see sample in test_updater.cc
string update(product p, PublicKey update_key, notifyRead_t notifyRead = nullptr);
// update() - convenience function doing load_key() and update()
string update(product p, string keyfile, notifyRead_t notifyRead = nullptr);
}
}