I have a 202 byte key and that is used to decrypt a binary file.
StringSource keyStr( key, Z3_KEY_LENGTH, true );
AutoSeededRandomPool rng;
ECIES<ECP>::Decryptor ellipticalEnc( keyStr );
unsigned char *tmpBuffer( new unsigned char[ src.Size() ] );
DecodingResult dr = ellipticalEnc.Decrypt( rng, src.Data(), src.Size(), tmpBuffer );
I tried to use jsafejce for this:
PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(key);
KeyFactory factory = KeyFactory.getInstance("EC", "JsafeJCE");
PrivateKey privateKey = factory.generatePrivate(privKeySpec);
Cipher eciesDecrypter = Cipher.getInstance("ECIES/SHA1/HMACSHA1", "JsafeJCE");
and
Cipher eciesDecrypter = Cipher.getInstance("ECIESwithXOR/SHA1/HMACSHA1", "JsafeJCE");
But with the first I get a block error, must be divided by 16, and with the second I get a mac check error.
Does anyone have any suggestions?