Guest User

Untitled

a guest
Apr 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. const forge = require('node-forge')
  2. const pki = forge.pki
  3.  
  4. const sign = (publicKeyPem, data, signature) => {
  5. const md = forge.md.sha1.create()
  6. md.update(data, 'utf8');
  7.  
  8. const publicKey = pki.publicKeyFromPem(publicKeyPem)
  9. return publicKey.verify(md.digest().bytes(), signature)
  10. }
  11.  
  12. module.exports = {
  13. sign
  14. }
Add Comment
Please, Sign In to add comment