From d9ebbb6c4a92a2391977c0d252ed87da725d8e28 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 13 Oct 2016 18:31:51 +0200 Subject: Comment envelope.{cpp,h} --- envelope.cpp | 52 +++++++++------------------------------------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/envelope.cpp b/envelope.cpp index 4971358..abf6e8f 100644 --- a/envelope.cpp +++ b/envelope.cpp @@ -14,8 +14,12 @@ using namespace std; namespace Envelope{ + // Envelope format: [AES encrypted data | RSA encrypted AES key | length of AES key] + // The encrypted AES key is in big-endian format, as is the length tag. The length tag + // is an unsigned 16-bit integer. + bool safeKey(const string &key){ - //checks against keys 0 and 1, because they don't undergo change in RSA + //checks against keys 0 and 1, because they don't undergo change in RSA enryption 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 @@ -30,36 +34,20 @@ namespace Envelope{ do { for(int i=0;i