#include #include "aes.h" #include "base64.h" //TODO: remove #include "envelope.h" #include "rng.h" using namespace std; namespace Envelope{ bool safeKey(const string &key){ //checks against keys 0 and 1, because they don't undergo change in RSA int i; for(i=0;i<(int)key.size();i++)if(key[i]!=0)break; if(i==(int)key.size())return false; //key is 0 if(i==(int)key.size()-1&&key[i]==1)return false; //key is 1 return true; //fine } string encrypt(const string &data,const RSA::Key &pubkey){ const int keylen=8; //256-bit CryptoRng crng; string aeskey(4*keylen,'\0'); do { for(int i=0;i