2024-03-20, 00:06
Hi,
I would like to transport the following JS code to Kodi Add-on Python.
I don't know which library I have to use for the PBKDF2 and decrypt with option KEY and IV.
Please guide me for this.
Thank you in advance.
JS Script:
function CryptoJSAesDecrypt(passphrase, encrypted_json_string) {
var obj_json = JSON.parse(encrypted_json_string);
var encrypted = obj_json.ciphertext;
var salt = CryptoJS.enc.Hex.parse(obj_json.salt);
var iv = CryptoJS.enc.Hex.parse(obj_json.iv);
var key = CryptoJS.PBKDF2(passphrase, salt, { hasher: CryptoJS.algo.SHA512, keySize: 64/8, iterations: 999});
var decrypted = CryptoJS.AES.decrypt(encrypted, key, { iv: iv});
return decrypted.toString(CryptoJS.enc.Utf8);
}
I would like to transport the following JS code to Kodi Add-on Python.
I don't know which library I have to use for the PBKDF2 and decrypt with option KEY and IV.
Please guide me for this.
Thank you in advance.
JS Script:
function CryptoJSAesDecrypt(passphrase, encrypted_json_string) {
var obj_json = JSON.parse(encrypted_json_string);
var encrypted = obj_json.ciphertext;
var salt = CryptoJS.enc.Hex.parse(obj_json.salt);
var iv = CryptoJS.enc.Hex.parse(obj_json.iv);
var key = CryptoJS.PBKDF2(passphrase, salt, { hasher: CryptoJS.algo.SHA512, keySize: 64/8, iterations: 999});
var decrypted = CryptoJS.AES.decrypt(encrypted, key, { iv: iv});
return decrypted.toString(CryptoJS.enc.Utf8);
}