Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
RSA.rb is a pure-Ruby implementation of the RSA encryption algorithm and the PKCS#1 cryptography standard.
Ruby
branch: master

README.md

RSA.rb: RSA Encryption for Ruby

RSA.rb is a Ruby library that implements the RSA encryption algorithm and the PKCS#1 cryptography standard.

Features

  • 100% free and unencumbered public domain software.
  • Implements the PKCS#1 data conversion primitives (I2OSP and OS2IP).
  • Implements the PKCS#1 encryption/decryption primitives (RSAEP and RSADP).
  • Implements the PKCS#1 signature primitives (RSASP1 and RSAVP1).
  • Implements RSA key pair generation using Ruby's OpenSSL standard library.
  • Compatible with Ruby 1.9.1+ and JRuby 1.5.0+.
  • Compatible with older Ruby versions with the help of the Backports gem.

Examples

require 'rsa'

Generating a new RSA key pair

key_pair = RSA::KeyPair.generate(128)

Encrypting a plaintext message

ciphertext = key_pair.encrypt("Hello, world!")

Decrypting a ciphertext message

plaintext = key_pair.decrypt(ciphertext)

Documentation

http://rsa.rubyforge.org/

  • {RSA::KeyPair}
  • {RSA::Key}
  • {RSA::PKCS1}

Dependencies

Installation

The recommended installation method is via RubyGems. To install the latest official release of RSA.rb, do:

% [sudo] gem install rsa             # Ruby 1.9.1+
% [sudo] gem install backports rsa   # Ruby 1.8.x

Download

To get a local working copy of the development repository, do:

% git clone git://github.com/bendiken/rsa.git

Alternatively, you can download the latest development version as a tarball as follows:

% wget http://github.com/bendiken/rsa/tarball/master

Author

Contributors

Refer to the accompanying {file:CREDITS} file.

Contributing

  • Do your best to adhere to the existing coding conventions and idioms.
  • Don't use hard tabs, and don't leave trailing whitespace on any line.
  • Do document every method you add using YARD annotations. Read the tutorial or just look at the existing code for examples.
  • Don't touch the .gemspec, VERSION or AUTHORS files. If you need to change them, do so on your private branch only.
  • Do feel free to add yourself to the CREDITS file and the corresponding list in the the README. Alphabetical order applies.
  • Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an explicit public domain dedication on record from you.

License

This is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying {file:UNLICENSE} file.

Something went wrong with that request. Please try again.