I am using KARATE with the standalone JAR, version 0.9.5.RC5. Inside a Karate scenario, I have to sign a string with a private key, using the SHA256 with ECDSA algorithm, in base64. I need this signature further in a request. So, I have written in the scenario :
* def stringtobesigned = 'mystringtosign'
* def privkey = 'DeIHYzu9...'
* def Signature = call read('sha256ECDSA.js')
And in the sha256ECDSA.js file, I have written :
function fn() {
var mykey = karate.get('privkey');
var strToBeSigned = karate.get('idstring2signed');
...
return signValue;
}
Can anybody tell me how to implement this algorithm in my use case? I need to replace '...' with the right code, to the value 'signValue'. Thanks a lot.