z-hao-wang / react-native-rsa

React native rsa crypto
MIT License
68 stars 19 forks source link

How to create / verify a signature? #3

Closed edolfuchs closed 7 years ago

edolfuchs commented 8 years ago

How can I create/verify digital signature to react-native-rsa ?.

Anybody know?

haowang-usc commented 8 years ago

I believe you need to

  1. generate a hash of original content (hash size smaller than RSA key size)
  2. encrypt the hash with private key see this commit https://github.com/xing-zheng/react-native-rsa/commit/6ebeaaee2379c51aaf119d9dac1180c4e1166175
  3. The receiver then try to use public key to decrypt and verify the hash is same with hash of original content
  4. you can make a PR for it after you make it work.