Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(data => {
var pk = KEYUTIL.getKey(data);
var sig = new KJUR.crypto.Signature({"alg": "SHA512withRSA"}); // Use "SHA1withRSA" for QZ Tray 2.0 and older
sig.init(pk);
sig.updateString(hash);
var hex = sig.sign();
console.log("DEBUG: \n\n" + stob64(hextorstr(hex)));
resolve(stob64(hextorstr(hex)));
})
.catch(err => console.error(err));
constructor(pem) {
const method = 'constructor';
LOG.entry(method, pem);
this.pem = pem;
this.certificate = new X509();
this.certificate.readCertPEM(pem);
this.publicKey = KEYUTIL.getPEM(this.certificate.getPublicKey());
this.identifier = KJUR.crypto.Util.hashHex(this.certificate.getPublicKey().pubKeyHex, 'sha256');
this.issuer = KJUR.crypto.Util.hashHex(this.certificate.getIssuerString(), 'sha256');
this.name = /(\/CN=)(.*?)(\/|,|$)/.exec(this.certificate.getSubjectString())[2];
LOG.exit(method);
}
constructor(pem) {
const method = 'constructor';
LOG.entry(method, pem);
this.pem = pem;
this.certificate = new X509();
this.certificate.readCertPEM(pem);
this.publicKey = KEYUTIL.getPEM(this.certificate.getPublicKey());
this.identifier = KJUR.crypto.Util.hashHex(this.certificate.getPublicKey().pubKeyHex, 'sha256');
this.issuer = KJUR.crypto.Util.hashHex(this.certificate.getIssuerString(), 'sha256');
this.name = /(\/CN=)(.*?)(\/|,|$)/.exec(this.certificate.getSubjectString())[2];
LOG.exit(method);
}
private generate_at_hash(access_token: any): string {
const hash = KJUR.crypto.Util.hashString(access_token, 'sha256');
const first128bits = hash.substr(0, hash.length / 2);
const testdata = hextob64u(first128bits);
return testdata;
}
}
private generate_at_hash(access_token: any): string {
const hash = KJUR.crypto.Util.hashString(access_token, 'sha256');
const first128bits = hash.substr(0, hash.length / 2);
const testdata = hextob64u(first128bits);
return testdata;
}
encryptValue(value) : string {
var keyObj = KEYUTIL.getKey(this.key);//this.session.keys[0]);//sessionObj.keys[0]);
var hex = KJUR.crypto.Cipher.encrypt(value, keyObj);
return '{enc}' + hextob64(hex);
}
generate_code_verifier(code_challenge: any): string {
const hash = KJUR.crypto.Util.hashString(code_challenge, 'sha256');
const testdata = hextob64u(hash);
return testdata;
}
}
private generate_at_hash(access_token: any): string {
const hash = KJUR.crypto.Util.hashString(access_token, 'sha256');
const first128bits = hash.substr(0, hash.length / 2);
const testdata = hextob64u(first128bits);
return testdata;
}