diff options
Diffstat (limited to 'envelope.cpp')
-rw-r--r-- | envelope.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/envelope.cpp b/envelope.cpp index abf6e8f..0c995bd 100644 --- a/envelope.cpp +++ b/envelope.cpp @@ -59,6 +59,7 @@ namespace Envelope{ string decrypt(const string &data,const RSA::Key &privkey){ if(data.size()<2)throw invalid_argument("Envelope data length invalid"); + //This double cast is necessary because of sign extension. int encrkeylen=((uint16_t)(uint8_t)data[data.size()-2]<<8)+(uint8_t)data.back(); assert(encrkeylen<(1<<16)); if((int)data.size()<encrkeylen+2)throw invalid_argument("Envelope key format invalid"); |