Class: Izokatu::Openssl::PublicKey::RSA::KeysGenerator
- Inherits:
-
KeysGenerator
- Object
- KeysGenerator
- Izokatu::Openssl::PublicKey::RSA::KeysGenerator
- Defined in:
- lib/izokatu/openssl/public_key/rsa/keys_generator.rb
Overview
OpenSSL RSA keys generator
Constant Summary collapse
- DEFAULT_OPTIONS =
Default options for OpenSSL RSA keys generation
{ bit_number: 4096 }.freeze
Constants inherited from KeysGenerator
KeysGenerator::KEYS_SYMBOLS, KeysGenerator::KEY_CLASSES
Instance Attribute Summary collapse
-
#bit_number ⇒ Integer
readonly
Bit number for OpenSSL RSA encryption/decryption.
Instance Method Summary collapse
-
#generate_private_key ⇒ OpenSSL::PKey::RSA
private
Performing generation of OpenSSL RSA private key.
-
#generate_public_key(private_key) ⇒ OpenSSL::PKey::RSA
private
Performing generation of OpenSSL RSA private key.
-
#initialize(bit_number:) ⇒ KeysGenerator
constructor
Initialize option for OpenSSL RSA keys generation.
-
#perform ⇒ Hash
Performing generation of OpenSSL RSA private and public keys.
Methods included from Callable
Constructor Details
#initialize(bit_number:) ⇒ KeysGenerator
Initialize option for OpenSSL RSA keys generation
24 25 26 27 |
# File 'lib/izokatu/openssl/public_key/rsa/keys_generator.rb', line 24 def initialize(bit_number:) super() @bit_number = bit_number || DEFAULT_OPTIONS[:bit_number] end |
Instance Attribute Details
#bit_number ⇒ Integer (readonly)
Returns bit number for OpenSSL RSA encryption/decryption.
11 12 13 |
# File 'lib/izokatu/openssl/public_key/rsa/keys_generator.rb', line 11 def bit_number @bit_number end |
Instance Method Details
#generate_private_key ⇒ OpenSSL::PKey::RSA (private)
Performing generation of OpenSSL RSA private key
47 48 49 |
# File 'lib/izokatu/openssl/public_key/rsa/keys_generator.rb', line 47 def generate_private_key OpenSSL::PKey::RSA.new(bit_number) end |
#generate_public_key(private_key) ⇒ OpenSSL::PKey::RSA (private)
Performing generation of OpenSSL RSA private key
57 58 59 |
# File 'lib/izokatu/openssl/public_key/rsa/keys_generator.rb', line 57 def generate_public_key(private_key) private_key.public_key end |
#perform ⇒ Hash
Performing generation of OpenSSL RSA private and public keys
35 36 37 |
# File 'lib/izokatu/openssl/public_key/rsa/keys_generator.rb', line 35 def perform super.transform_values(&:to_pem) end |