public
Description:
Homepage:
Clone URL: git://github.com/technoweenie/pki.git
pki /
name age message
file .document Sun May 31 15:52:43 -0700 2009 Initial commit to pki. [technoweenie]
file .gitignore Sun May 31 15:52:43 -0700 2009 Initial commit to pki. [technoweenie]
file LICENSE Sun May 31 15:52:43 -0700 2009 Initial commit to pki. [technoweenie]
file README.rdoc Sun May 31 16:34:22 -0700 2009 update readme [technoweenie]
file Rakefile Sun May 31 15:52:43 -0700 2009 Initial commit to pki. [technoweenie]
file VERSION.yml Sun May 31 16:42:39 -0700 2009 Version bump to 1.1.0 [technoweenie]
directory lib/ Sun May 31 16:44:43 -0700 2009 mimick ezcrypto api [technoweenie]
file pki.gemspec Sun May 31 16:57:49 -0700 2009 add summary [technoweenie]
directory test/ Sun May 31 16:44:43 -0700 2009 mimick ezcrypto api [technoweenie]
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.