Crypto in ruby
Published June 16th, 2005 edit replace rm!
Nick asked on ruby-talk how to do simple encryption using ruby and it’s built in OpenSSL module.
I’ve just registred an ezcrypto module at rubyforge, which should make it a lot easier to use. There currently is no code there, but I will be uploading something shortly.
However to get started here is a little starter:
require 'openssl' require 'digest/sha2' cipher = OpenSSL::Cipher::Cipher.new('aes-192-cbc') cipher.encrypt cipher.key=Digest::SHA256.digest("super secret password") encrypted= cipher<<"data to be encrypted..." # Note this needs to be padded to be the block size of the cipher.
To do decrypt just use cipher.decrypt instead.
Timo Mika Gläßer November 3rd, 2007
Hey,
do you actually know if it is possible to have multiple signing keys thus allowing multiple users toi decrypt a model in ezcrypto?
Regards
Timo&*