How to go about signing text in a verifiable way from within ruby in a simple yet strong & portable

Posted by roja on Stack Overflow See other posts from Stack Overflow or by roja
Published on 2010-05-24T11:35:11Z Indexed on 2010/05/24 11:41 UTC
Read the original article Hit count: 194

Guys,

I have been looking for a portable method to digitally sign arbitrary text which can be placed in a document and distributed while maintaining its verifiable origin. Here is an example:

a = 'some text'
a.sign(<private key>) # => <some signature in ASCII format>

The contents of a can now be distributed freely. If a receiver wants to check the validity of said text they can do the following:

b = 'some text'
b.valid(<public key>, <signature supplied with text>) # => true/false

Is there any library out there that already offers this kind of functionality? Ruby standard library contains SHA hashing code so at lest there is a portable way to perform the hashing but from that point I am struggling to find anything which fits purpose.

Kind Regards,

Roja

© Stack Overflow or respective owner

Related posts about ruby

Related posts about encryption