blob: 417a1bf7b3a20f848d6694704db264a01b1f8973 [file] [log] [blame]
var BN = require('bn.js')
var Buffer = require('safe-buffer').Buffer
function withPublic (paddedMsg, key) {
return Buffer.from(paddedMsg
.toRed(BN.mont(key.modulus))
.redPow(new BN(key.publicExponent))
.fromRed()
.toArray())
}
module.exports = withPublic