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

53 lines
1.3 KiB

// this file is under GNU General Public License 3.0
// see LICENSE.txt
#pragma once
#include <string>
#include <iostream>
#include <sstream>
#include <boost/iostreams/stream.hpp>
#include <cryptopp/rsa.h>
#include <cryptopp/gcm.h>
#include <cryptopp/aes.h>
#include <cryptopp/files.h>
#include "HTTPSStream.hh"
namespace pEp {
namespace UpdateClient {
using namespace std;
namespace io = boost::iostreams;
struct product {
string name;
string url;
};
typedef CryptoPP::RSA::PublicKey PublicKey;
class UpdateDevice : public io::source {
product _p;
CryptoPP::GCM< CryptoPP::AES >::Decryption _delivery_decryptor;
CryptoPP::SecByteBlock _key;
CryptoPP::FileSource *_src;
iostream *_str;
public:
HTTPSStream _https;
UpdateDevice(const product p);
UpdateDevice(const UpdateDevice& second);
~UpdateDevice();
streamsize read(char* s, streamsize n);
void open(PublicKey update_key, notifyRead_t notifyRead = nullptr);
void close();
string filename() { return _https->filename(); }
};
typedef io::stream< UpdateDevice > UpdateStream;
}
}