|
|
|
@ -14,7 +14,48 @@ namespace pEp {
|
|
|
|
|
DownloadError() : runtime_error("download not possible") { }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct CannotLoadKey : runtime_error {
|
|
|
|
|
CannotLoadKey(string filename)
|
|
|
|
|
: runtime_error("cannot load key from " + filename)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
//
|
|
|
|
|
// returns:
|
|
|
|
|
// filename of downloaded file
|
|
|
|
|
//
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
|
// update() - convenience function doing load_key() and update()
|
|
|
|
|
|
|
|
|
|
string update(product p, string keyfile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|