I am having an issue in which I encrypt my data, and it seems to be
working; however, when I attempt to decrypt the data it returns
gibberish after a 0x00 value. For instance I *send in a byte[256]
that contains all 0x61, with several 0x00* interjected. I am doing
this as a proof of concept, being that I would like to use the GCM
model to encrypt data that will contain 0x00 within.
My Encryption:
int encrypt(byte iv[12], const byte *in, int *size, byte *out)
{
string messageData = (char *)in;
string tempOut;
try
{
GCM<AES>::Encryption e;
e.SetKeyWithIv(key, 32, iv, 12);
AuthenticatedEncryptionFilter ef(e, new StringSink(tempOut),
false, 4);
ef.ChannelPut("", (const byte*)messageData.data(), *size);
ef.ChannelMessageEnd("");
memcpy(out, tempOut.data(), *size - 4);
*size -= 4;
}
catch
{
...
}
return (1);
}
My Decryption:
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.