aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--envelope.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/envelope.cpp b/envelope.cpp
index a8cd793..9bb011e 100644
--- a/envelope.cpp
+++ b/envelope.cpp
@@ -57,7 +57,7 @@ namespace Envelope{
string decrypt(const string &data,const RSA::PrivateKey &privkey){
cerr<<"=== DECRYPT ==="<<endl;
if(data.size()<2)throw invalid_argument("Envelope data length invalid");
- int encrkeylen=((uint16_t)data[data.size()-2]<<8)+(uint16_t)data.back();
+ int encrkeylen=((uint16_t)(uint8_t)data[data.size()-2]<<8)+(uint8_t)data.back();
assert(encrkeylen<(1<<16));
cerr<<"encrkeylen="<<encrkeylen<<endl;
if((int)data.size()<encrkeylen+2)throw invalid_argument("Envelope key format invalid");