module Ronin::Support::Network::SSL::LocalKey
Represents the RSA signing key used for local SSL
server sockets.
@api private
Constants
- PATH
-
The cached ‘~/.local/share/ronin/ssl.key` file.
Public Class Methods
Source
# File lib/ronin/support/network/ssl/local_key.rb, line 75 def self.fetch if File.file?(PATH) then load else generate end end
The default RSA key used for all SSL
server sockets.
@return [Crypto::Key::RSA]
The default RSA key.
Source
# 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
Generates a new RSA key and saves it to ‘~/.local/share/ronin/ssl.key`.
@return [Crypto::Key::RSA]
The newly generated key.
@note
The file will be created with a chmod umask of `0640` (aka `-rw-r-----`).
Source
# File lib/ronin/support/network/ssl/local_key.rb, line 65 def self.load Crypto::Key::RSA.load_file(PATH) end
Loads the RSA key from ‘~/.local/share/ronin/ssl.key`.
@return [Crypto::Key::RSA]
The loaded RSA key.