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
fetch()
click to toggle source
The default RSA key used for all SSL
server sockets.
@return [Crypto::Key::RSA]
The default RSA key.
# 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()
click to toggle source
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-----`).
# 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()
click to toggle source
Loads the RSA key from ‘~/.local/share/ronin/ssl.key`.
@return [Crypto::Key::RSA]
The loaded RSA key.
# File lib/ronin/support/network/ssl/local_key.rb, line 65 def self.load Crypto::Key::RSA.load_file(PATH) end