|
Hi, I'm using
ECIES/ECP for encryption/decryption. As I understand it, a message with size n
encrypted with 224 bit ECIES should be n bytes long + two 224 bit numbers,
which is n+56 bytes. When I encrypt a 16 byte message, the result is 93 bytes
rather than 72. What are the other bytes and how can I extract the
"raw" encrypted message from the data I get from crypto++? Source code: ---------- #include
<string> #include
<stdio.h> // #include
<oids.h> #include
<osrng.h> #include
<eccrypto.h> using namespace
CryptoPP; void test() { //
Generate keys and initialize encryptor AutoSeededRandomPool
rng; typedef
ECIES<ECP>::PrivateKey ECPrivateKey; ECPrivateKey
privkey; Integer
integer("11111111111111111111111111111111111111111111111111111111h"); privkey.Initialize(ASN1::secp224r1(),
integer); typedef
ECIES<ECP>::PublicKey ECPublicKey; ECPublicKey
pubkey;
privkey.MakePublicKey(pubkey); typedef
ECIES<ECP>::Encryptor ECEncryptor; ECEncryptor
encryptor(pubkey); //
Encrypt string
sContents("0123456789012345"); // 16 bytes SecByteBlock
sbbCipherText(encryptor.CiphertextLength(sContents.size())); encryptor.Encrypt( rng, (byte
const*) sContents.data(), sContents.size(), sbbCipherText.begin()); //
This prints 93, expected 72 (72 is 2*224/8+16) printf("Size:
%d\n", sbbCipherText.size()); } int main() { test(); return
0; } --------- //Lars |
