feat: add (rsa)pubKey.encrypt and (rsa)privKey.decrypt

nodeJS only for now
This commit is contained in:
Maciej Krüger
2019-07-12 18:53:46 +02:00
committed by Jacob Heun
parent a008bc2fcb
commit 34c5f5c8f0
3 changed files with 21 additions and 2 deletions

View File

@ -80,6 +80,13 @@ describe('RSA', function () {
expect(valid).to.be.eql(true)
})
it('encrypt and decrypt', async () => {
const data = Buffer.from('hello world')
const enc = await key.public.encrypt(data)
const dec = await key.decrypt(enc)
expect(dec).to.be.eql(data)
})
it('fails to verify for different data', async () => {
const data = Buffer.from('hello world')
const sig = await key.sign(data)