0

Welcome! My job is to implement digital signature. I've read everything about creating public and private key but I'm stuck with this silly thing. How do I encrypt this checksum(SHA256) using RSA algorithm? I mean part: c(m) = m ^ e mod n. Should I convert this checksum(which is HEX?) to int, so that then I can compute ^e mod n?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Szycho
  • 1
  • 1
  • Are you trying to do this on your own? Or are you using the built in RSA encryption provider? [look here](http://stackoverflow.com/questions/1199058/how-to-use-rsa-to-encrypt-files-huge-data-in-c-sharp) – TheNorthWes Jun 21 '14 at 15:29
  • My aim is to implement it on my own way, avoiding built-in or external libraries. – Szycho Jun 22 '14 at 17:44
  • 1
    Why? Homework? Reimplementing security is almost guaranteed to be a quagmire of problems. – TheNorthWes Jun 22 '14 at 18:40

1 Answers1

1

You don't encrypt the checksum but sign it. If you use C#, take a look at RSACryptoServiceProvider class, in particular in MSDN's Cryptographic Signatures section which contains detailed description of the process.

However it seems that you are reinventing the wheel and going too low-level. Maybe higher-level libraries like BouncyCastle or free CryptoBlackbox package of our SecureBlackbox will be easier to use.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121