-
-
Notifications
You must be signed in to change notification settings - Fork 644
NOTE jsrsasign 4.9.x to 5.0.0 JWS API migration guide
Kenji Urushima edited this page Aug 12, 2020
·
1 revision
While jsrsasign version update from 4.9.2 to 5.0.0 or later, some deprecated JWS class APIs are removed.
This page will show you how to migrate your code for jsrsasign 5.0.0.
From JWS.verifyJWSByNE
var jws = new KJUR.jws.JWS();
var isValid = jws.verifyJWSByNE(sJWS, hN, hE);
// will be modified to
var pubkey = KEYUTIL.getKey({n: hN, e: hE});
var isValid = KJUR.jws.JWS.verify(sJWS, pubkey);
From JWS.verifyJWSByKey
var jws = new KJUR.jws.JWS();
var isValid = jws.verifyJWSByKey(sJWS, key);
// will be modified to
var isValid = KJUR.jws.JWS.verify(sJWS, key);
From JWS.verifyByPemX509Cert
var jws = new KJUR.jws.JWS();
var isValid = jws.verifyJWSByPemX509Cert(sJWS, sPemX509Cert);
// will be modified to
var pubkey = KEYUTIL.getKey(sPemX509Cert);
var isValid = KJUR.jws.JWS.verify(sJWS, pubkey);
From JWS.generateJWSByNED
var jws = new KJUR.jws.JWS();
var hJWS = jws.generateJWSByNED(sHead, sPayload, hN, hE, hD);
// will be modified to
var prvkey = KEYUTIL.getKey({n: hN, e: hE, d: hD});
var hJWS = KJUR.jws.JWS.sign(null, sHead, sPayload, prvkey);
From JWS.generateJWSByKey
var jws = new KJUR.jws.JWS();
var hJWS = jws.generateJWSByKey(sHead, sPayload, prvKey);
// will be modified to
var hJWS = KJUR.jws.JWS.sign(null, sHead, sPayload, prvkey);
From JWS.generateJWSByP1PrvKey
var jws = new KJUR.jws.JWS();
var hJWS = jws.generateJWSByP1PrvKey(sHead, sPayload, sPemPrvKey);
// will be modified to
var prvkey = KEYUTIL.getKey(sPemPrvKey);
var hJWS = KJUR.jws.JWS.sign(null, sHead, sPayload, prvkey);