INNER CODE UNIT · JavaScript

getAcceptableSigningAlgs

DinoChiesa/jwt-webtool · src/js/app.js:452

function getAcceptableSigningAlgs(key) {
  const keytype = key.kty;
  if (keytype == "oct") return hmacSigningAlgs;
  if (keytype == "RSA") return rsaSigningAlgs;
  if (keytype == "EC") {
    if (key.length == 256) return ["ES256"];
    if (key.length == 384) return ["ES384"];
    if (key.length == 521) return ["ES512"];
  }
  return ["NONE"];
}

function getAcceptableEncryptionAlgs(key) {
  const keytype = key.kty;
  if (keytype == "RSA") return rsaKeyEncryptionAlgs;
  if (keytype == "oct")
    return [...pbes2KeyEncryptionAlgs, ...kwKeyEncryptionAlgs, "dir"];
  if (keytype == "EC") return ecdhKeyEncryptionAlgs;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…