Openssl_get_privatekey and openssl_sign - how to make with CryptoJS

Hi!

Faced with a problem, that I need to decrypt private key encrypted in PHP, get signature and validate it.

PHP code looks like

$privateKey = openssl_get_privatekey(file_get_contents('private2.pem'), $privateKeyPassword);
openssl_sign($challenge, $signature, $privateKey, $algorithm); 

I need to perform these actions in Postman, trying to use cryptoJS, but getting some incorrect values.
// Decrypt
var privateKey = CryptoJS.AES.decrypt(privateKeyEncrypted,
privateKeyPassword).toString(CryptoJS.enc.Base64);
pm.environment.set(“privateKetDecripted”, privateKey);
console.log(privateKey);

var signature = CryptoJS.HmacSHA256(challenge, privateKey).toString(CryptoJS.enc.Base64)
pm.environment.set("signature", signature);
console.log(signature); 

Maybe someone already made pre-scripts to make the same actions?