mirror of
https://git.coolaj86.com/coolaj86/old-keypairs.js
synced 2025-03-14 12:20:42 +00:00
Compare commits
No commits in common. "master" and "v1.2.14" have entirely different histories.
@ -240,7 +240,7 @@ Keypairs.signJws = function (opts) {
|
||||
if ('EC' === opts.jwk.kty) {
|
||||
// ECDSA JWT signatures differ from "normal" ECDSA signatures
|
||||
// https://tools.ietf.org/html/rfc7518#section-3.4
|
||||
binsig = ecdsaAsn1SigToJoseSig(binsig);
|
||||
binsig = convertIfEcdsa(binsig);
|
||||
}
|
||||
|
||||
var sig = binsig.toString('base64')
|
||||
@ -257,7 +257,7 @@ Keypairs.signJws = function (opts) {
|
||||
};
|
||||
}
|
||||
|
||||
function ecdsaAsn1SigToJoseSig(binsig) {
|
||||
function convertIfEcdsa(binsig) {
|
||||
// should have asn1 sequence header of 0x30
|
||||
if (0x30 !== binsig[0]) { throw new Error("Impossible EC SHA head marker"); }
|
||||
var index = 2; // first ecdsa "R" header byte
|
||||
|
Loading…
x
Reference in New Issue
Block a user