I need to convert crypto from NodeJS to Java. My secretKey is 63 bytes, and don't use IV. How can I convert 2 functions below to Java? Can anyone show me a snippet? Thank you!
var secretKey = 'fkldsjfweurioweurioewur819734897489327489327843fsdkfjdskjfdsklj'; //63 bytes
function textEncrypt() {
const cipher = crypto.createCipher('aes-256-cbc', secretKey);
let crypted = cipher.update(data, 'utf-8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
function textDecrypt(encrypted) {
const decipher = crypto.createDecipher('aes-256-cbc', secretKey);
let decrypted = decipher.update(encrypted, 'hex', 'utf-8');
decrypted += decipher.final('utf-8');
return decrypted;
}