Even noisier debug and key preservation

This commit is contained in:
Satsuoni 2021-08-04 13:00:58 +09:00
parent 6496c88b86
commit fc45b63024
2 changed files with 8 additions and 10 deletions

View File

@ -139,11 +139,11 @@ WidevineCrypto.tryDecodingKey=async function(encKey)
return new Uint8Array(hexToBytes(res));
}
WidevineCrypto.decryptContentKey = async function(sesid,licenseRequest, licenseResponse)
WidevineCrypto.decryptContentKey = async function(sesid,sdat)
{
await this.initLog();
licenseRequest = SignedMessage.read(new Pbf(licenseRequest));
licenseResponse = SignedMessage.read(new Pbf(licenseResponse));
licenseRequest = SignedMessage.read(new Pbf(sdat.licenseRequest));
licenseResponse = SignedMessage.read(new Pbf(sdat.licenseResponse));
//console.log("Decrypting?")
//console.log("Request (from us)")
this.log(licenseRequest)
@ -190,7 +190,7 @@ WidevineCrypto.decryptContentKey = async function(sesid,licenseRequest, licenseR
// finally decrypt the content key
var decryptedKey = wordToByteArray(
this.cryptoJS.AES.decrypt({ ciphertext: arrayToWordArray(keyData) }, arrayToWordArray(encryptKey), { iv: arrayToWordArray(keyIv) }).words);
sdat.keys.set(toHexString(keyId),toHexString(decryptedKey));
contentKeys.push(decryptedKey);
this.log("WidevineDecryptor: Session: "+sesid+ " KID= " + toHexString(keyId)+" Key: "+toHexString(decryptedKey) );
}

View File

@ -18,6 +18,7 @@ function SessionData(sess)
this.self=sess;
this.licenseRequest=null;
this.licenseResponse=null;
this.keys=new Map();
}
/**
* Gets called whenever an EME method is getting called or an EME event fires
@ -67,14 +68,11 @@ EmeInterception.onOperation = function(operationType, args,target)
c_sessions.set(sesid,sdat);
if (sdat.licenseResponse!==null && sdat.licenseRequest!==null)
{
WidevineCrypto.decryptContentKey(sesid,sdat.licenseRequest, sdat.licenseResponse);
WidevineCrypto.decryptContentKey(sesid,sdat);
c_sessions.set(sesid,sdat);
}
}
lastReceivedLicenseResponse = licenseResponse;
// OK, let's try to decrypt it, assuming the response correlates to the request
}
else if (operationType == "KeyStatusesChangeEvent")
{