INNER CODE UNIT · JavaScript

getPbkdf2SaltBuffer

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

function getPbkdf2SaltBuffer() {
  const saltText = $sel("#ta_pbkdf2_salt").value.trim(),
    coding = $sel(
      ".sel-symkey-pbkdf2-salt-coding",
    ).selectedOptions[0].text.toLowerCase(),
    knownCodecs = ["utf-8", "base64", "hex"];

  if (knownCodecs.indexOf(coding) >= 0) {
    return Buffer.from(saltText, coding);
  }
  throw new Error("unsupported salt encoding"); // will not happen
}

const getPbkdf2HashForAlg = (alg) => {
  if (alg == "PBES2-HS384+A192KW") {
    return "PBKDF2-SHA-384";
  }
  if (alg == "PBES2-HS512+A256KW") {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…