packages/js-crypto-rsa/src/rsa.js
function assertSignVerify(msg, jwkey, hash, algorithm, mode){
  if (algorithm.name !== 'RSA-PSS' && algorithm.name !== 'RSASSA-PKCS1-v1_5') throw new Error('InvalidAlgorithm');
  if (Object.keys(params.hashes).indexOf(hash) < 0) throw new Error('UnsupportedHash');
  if (!(msg instanceof Uint8Array)) throw new Error('InvalidMessageFormat');
  if (jwkey.kty !== 'RSA') throw new Error('InvalidJwkRsaKey');
  if (algorithm.name === 'RSA-PSS'){
    checkPssLength(mode, {k: jseu.encoder.decodeBase64Url(jwkey.n).length, hash, saltLength: algorithm.saltLength});
  }
  return true;
}
function assertSignVerify(msg, jwkey, hash, algorithm, mode){
  if (algorithm.name !== 'RSA-PSS' && algorithm.name !== 'RSASSA-PKCS1-v1_5') throw new Error('InvalidAlgorithm');
  if (Object.keys(params.hashes).indexOf(hash) < 0) throw new Error('UnsupportedHash');
  if (!(msg instanceof Uint8Array)) throw new Error('InvalidMessageFormat');
  if (jwkey.kty !== 'RSA') throw new Error('InvalidJwkRsaKey');
  if (algorithm.name === 'RSA-PSS'){
    checkPssLength(mode, {k: jseu.encoder.decodeBase64Url(jwkey.n).length, hash, saltLength: algorithm.saltLength});
  }
  return true;
}
function assertSignVerify ( msg , jwkey , hash , algorithm , mode ) { if ( algorithm . name !== 'RSA-PSS' && algorithm . name !== 'RSASSA-PKCS1-v1_5' ) throw new Error ( 'InvalidAlgorithm' ) ; if ( Object . keys ( params . hashes ) . indexOf ( hash ) < 0 ) throw new Error ( 'UnsupportedHash' ) ; if ( ! ( msg instanceof Uint8Array ) ) throw new Error ( 'InvalidMessageFormat' ) ; if ( jwkey . kty !== 'RSA' ) throw new Error ( 'InvalidJwkRsaKey' ) ; if ( algorithm . name === 'RSA-PSS' ) { checkPssLength ( mode , { k : jseu . encoder . decodeBase64Url ( jwkey . n ) . length , hash , saltLength : algorithm . saltLength } ) ; } return true ; }
RSA Signing parameter check.
@param {Uint8Array} msg - Byte array of message to be signed.
@param {JsonWebKey} jwkey - Private/Public key for signing/verifying in JWK format.
@param {String} hash - Name of hash algorithm like 'SHA-256'.
@param {RSASignAlgorithm} algorithm - Object to specify algorithm parameters.
@param {String} mode - 'sign' or 'verify' for PSS parameter check.
@return {boolean} - Always true unless thrown.
@throws {Error} - Throws if InvalidAlgorithm, UnsupportedHash, InvalidMessageFormat or InvalidJwkRsaKey
RSA Signing parameter check .