aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index 60198f7..2385da8 100644
--- a/main.cpp
+++ b/main.cpp
@@ -10,6 +10,7 @@
#include "aes.h"
#include "base64.h"
#include "bigint.h"
+#include "envelope.h"
#include "numalgo.h"
#include "primes.h"
#include "rng.h"
@@ -223,6 +224,17 @@ int main(int argc,char **argv){
// cout<<Base64::decode(s)<<flush;*/
// AES::test();
- cout<<Base64::encode(AES::encrypt("123456789abcdefx","goeiemorgen dit is leuke data enzoo",AES::AES_128_CBC))<<endl;
- cout<<AES::decrypt("123456789abcdefx",Base64::decode("dv2N3n2FHsD7LU2PAZnZm/bLQQSaaZoDDFjy3VrSu2JCHN5KuyBlinlh9C71IGTbT4/WvRKLp6dp1TfrKXIG2w=="),AES::AES_128_CBC)<<endl;
+ // cout<<Base64::encode(AES::encrypt("goeiemorgen dit is leuke data enzoo","123456789abcdefx",AES::AES_128_CBC))<<endl;
+ // cout<<AES::decrypt(Base64::decode("dv2N3n2FHsD7LU2PAZnZm/bLQQSaaZoDDFjy3VrSu2JCHN5KuyBlinlh9C71IGTbT4/WvRKLp6dp1TfrKXIG2w=="),"123456789abcdefx",AES::AES_128_CBC)<<endl;
+
+ RSA::PrivateKey privkey(RSA::genkey(2048,"goeiemorgen"));
+ cerr<<"privkey.pexp="<<privkey.pexp<<endl;
+ // stringstream ss("146142527763115590918816237475833862275078269531224490080731579415134484175830244922030574137988310092068583287060550616357026989772917226684940867892409");
+ // Bigint d;
+ // ss>>d;
+ // cout<<RSA::decrypt(d,privkey)<<endl;
+ string crypt(Envelope::encrypt("hallo hallo dit is leuke data enzo",privkey.pub));
+ cout<<Base64::encode(crypt)<<endl;
+ string decr(Envelope::decrypt(crypt,privkey));
+ cout<<decr<<endl;
}