Module: OpenPGP::Engine::OpenSSL::Random

Defined in:
lib/openpgp/engine/openssl.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#bytes(count, &block) ⇒ Object



22
23
24
# File 'lib/openpgp/engine/openssl.rb', line 22

def bytes(count, &block)
  ::OpenSSL::Random.random_bytes(count)
end

#number(bits = 32, options = {}) ⇒ Object



14
15
16
# File 'lib/openpgp/engine/openssl.rb', line 14

def number(bits = 32, options = {})
  ::OpenSSL::BN.rand(bits)
end

#prime(bits, options = {}) ⇒ Object



18
19
20
# File 'lib/openpgp/engine/openssl.rb', line 18

def prime(bits, options = {})
  ::OpenSSL::BN.generate_prime(bits, options[:safe])
end