I am using the bouncy castle ECIES with AES in CBC mode provider to encrypt data:
Cipher iesCipher = Cipher.getInstance("ECIESWITHAES-CBC");
iesCipher.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] ciphertext = iesCipher.doFinal(plaintext);
This results in a ciphertext with the format:
0x04 || coordinate x || coordinate y || PKCS5 padded ciphertext || 20-byte HMAC-digest
The 0x04
indicates the uncompressed format, where the y coordinate is also stored. Using eg. secp256k1, this results in 32 byte unnecessary overhead.
Now I would like to use the compressed format with 0x02
and 0x03
prefixes.
Unfortunately, I didn't find a specification of the parameters to use to achieve this.