Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 pki.gemspec
README.rdoc

pki

Amazingly simple pki encryption, using undocumented OpenSSL functions. Use public keys to encrypt data, and private keys to decrypt them.

# uses a randomly generated RSA private key
pki = Pki.new
encrypted = pki.encrypt('monkey')
pki.decrypt(encrypted) == 'monkey'

# load a private key from a stream.
# if no public key is specified, a new one is created using the existing
# private key.
pki = Pki.new(:private_key => File.open('my_priv_key'))

# load private/public keys
pki = Pki.new :private_key => "-----BEGIN RSA PRIVATE KEY-----\n..."
pki.public_key = OpenSSL::PKey::RSA.new(...)

# you can pretty much load private keys from strings, from streams, or PKey 
objects that respond to #public_encrypt and #private_decrypt.

Copyright

Copyright © 2009 rick. See LICENSE for details.

Something went wrong with that request. Please try again.