src/crypto/pkcs1.js
async function getPkcs1Padding(length) {
  let result = '';
  while (result.length < length) {
    const randomBytes = await random.getRandomBytes(length - result.length);
    for (let i = 0; i < randomBytes.length; i++) {
      if (randomBytes[i] !== 0) {
        result += String.fromCharCode(randomBytes[i]);
      }
    }
  }
  return result;
}
async function getPkcs1Padding(length) {
  let result = '';
  while (result.length < length) {
    const randomBytes = await random.getRandomBytes(length - result.length);
    for (let i = 0; i < randomBytes.length; i++) {
      if (randomBytes[i] !== 0) {
        result += String.fromCharCode(randomBytes[i]);
      }
    }
  }
  return result;
}
async function getPkcs1Padding ( length ) { let result = '' ; while ( result . length < length ) { const randomBytes = await random . getRandomBytes ( length - result . length ) ; for ( let i = 0 ; i < randomBytes . length ; i ++ ) { if ( randomBytes [ i ] !== 0 ) { result += String . fromCharCode ( randomBytes [ i ] ) ; } } } return result ; }
Create padding with secure random data
@private
@param  {Integer} length Length of the padding in bytes
@returns {String}        Padding as string
@async
Create padding with secure random data