Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSA PSS object
let alg = new RSA_PSS({
name: 'RSA-PSS',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSSASSA object
let alg = new RSASSA_PKCS1_v1_5({
name: 'RSASSA-PKCS1-v1_5',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSA PSS object
let alg = new RSA_PSS({
name: 'RSA-PSS',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSSASSA object
let alg = new RSASSA_PKCS1_v1_5({
name: 'RSASSA-PKCS1-v1_5',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}
})
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSA PSS object
let alg = new RSA_PSS({
name: 'RSA-PSS',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}
})
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSA PSS object
let alg = new RSA_PSS({
name: 'RSA-PSS',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}
})
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSSASSA object
let alg = new RSASSA_PKCS1_v1_5({
name: 'RSASSA-PKCS1-v1_5',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}
})
} else {
key = new CryptoKey({
type: 'public',
extractable: true,
usages: ['verify'],
handle: keyto.from(jwk, 'jwk').toString('pem', 'public_pkcs8')
})
}
} else {
throw new KeyFormatNotSupportedError(format)
}
// 3-7. Setup RSSASSA object
let alg = new RSASSA_PKCS1_v1_5({
name: 'RSASSA-PKCS1-v1_5',
modulusLength: base64url.toBuffer(jwk.n).length * 8,
publicExponent: new Uint8Array(base64url.toBuffer(jwk.e)),
hash: normalizedHash
})
// 8. Set algorithm of key to alg
key.algorithm = alg
// 9. Return key
return key
}