Sha256: 27896940cb852a6f94ea7aeb58f8378099cdac89024243fc6c363fe8f4ff7a55
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
module OpenPGP class Engine class OpenSSL < Engine def self.load!(reload = false) require 'openssl' unless defined?(::OpenSSL) || reload end def self.install! load! [Random, Digest].each { |mod| install_extensions! mod } end module Random #:nodoc: def number(bits = 32, options = {}) ::OpenSSL::BN.rand(bits) end def prime(bits, options = {}) ::OpenSSL::BN.generate_prime(bits, options[:safe]) end def bytes(count, &block) ::OpenSSL::Random.random_bytes(count) end end module Digest #:nodoc: def size ::OpenSSL::Digest.new(algorithm.to_s).digest_length end def hexdigest(data) ::OpenSSL::Digest.hexdigest(algorithm.to_s, data).upcase end def digest(data) ::OpenSSL::Digest.digest(algorithm.to_s, data) end end module Cipher #:nodoc: # TODO end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
klacointe-openpgp-0.0.1.4 | lib/openpgp/engine/openssl.rb |
openpgp-0.0.2 | lib/openpgp/engine/openssl.rb |
klacointe-openpgp-0.0.1.3 | lib/openpgp/engine/openssl.rb |