I am writing piece of code that decrypts data in java, which is encrypted in some C++ code using [poco lib] (http://pocoproject.org/docs/).
C++ code is similar as shown below:
std::string password = "secret";
std::string salt("asdff8723lasdf(**923412");
CipherKey key("aes-256", password, salt);
Also with iteration count of 2k.
DEFAULT_ITERATION_COUNT = 2000
How do I create that same key in java to decrypt the data? What is equivalent code in java?
I am trying something like this,
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
char[] passowrd = "secret".toCharArray();
byte[] salt = "asdff8723lasdf(**923412".getBytes();
KeySpec spec = new PBEKeySpec(passowrd,salt, 2000);
SecretKey tmp = factory.generateSecret(spec);
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), "AES");
But, it doesn't works. Gives me no such algorithm found exception. Which algorithm should I use? Do I need to know something more to decrypt?
UPDATE
I have added bounty castle to my security provider as pointed out by user2504380