Module: Ronin::Support::Network::SSL::LocalKey Private
- Defined in:
- lib/ronin/support/network/ssl/local_key.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Represents the RSA signing key used for local SSL server sockets.
Constant Summary collapse
- PATH =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The cached
~/.local/share/ronin/ssl.key
file. File.join(Home::LOCAL_SHARE_DIR,'ronin','ronin-support','ssl.key')
Class Method Summary collapse
-
.fetch ⇒ Crypto::Key::RSA
private
The default RSA key used for all SSL server sockets.
-
.generate ⇒ Crypto::Key::RSA
private
Generates a new RSA key and saves it to
~/.local/share/ronin/ssl.key
. -
.load ⇒ Crypto::Key::RSA
private
Loads the RSA key from
~/.local/share/ronin/ssl.key
.
Class Method Details
.fetch ⇒ Crypto::Key::RSA
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The default RSA key used for all SSL server sockets.
75 76 77 78 79 |
# File 'lib/ronin/support/network/ssl/local_key.rb', line 75 def self.fetch if File.file?(PATH) then load else generate end end |
.generate ⇒ Crypto::Key::RSA
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The file will be created with a chmod umask of 0640
(aka -rw-r-----
).
Generates a new RSA key and saves it to
~/.local/share/ronin/ssl.key
.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ronin/support/network/ssl/local_key.rb', line 48 def self.generate key = Crypto::Key::RSA.generate FileUtils.mkdir_p(File.dirname(PATH)) FileUtils.touch(PATH) FileUtils.chmod(0640,PATH) key.save(PATH) return key end |
.load ⇒ Crypto::Key::RSA
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Loads the RSA key from ~/.local/share/ronin/ssl.key
.
65 66 67 |
# File 'lib/ronin/support/network/ssl/local_key.rb', line 65 def self.load Crypto::Key::RSA.load_file(PATH) end |