module Ronin::Support::Crypto::Key::Methods::ClassMethods

Class-methods.

Public Instance Methods

load(key,**kwargs) click to toggle source

Alias for {#parse}.

@param [String] key

The PEM or DER encoded key string.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments for {#parse}.

@option kwargs [String, nil] :password

Optional password to decrypt the key.

@return [OpenSSL::PKey]

The parsed key.

@see parse

@api public

# File lib/ronin/support/crypto/key/methods.rb, line 99
def load(key,**kwargs)
  parse(key,**kwargs)
end
load_file(path,**kwargs) click to toggle source

Loads a key from a file.

@param [String] path

The path to the PEM or DER encoded key file.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments for {parse}.

@option kwargs [String, nil] :password

Optional password to decrypt the key.

@return [OpenSSL::PKey]

The parsed key.

@api public

# File lib/ronin/support/crypto/key/methods.rb, line 120
def load_file(path,**kwargs)
  parse(File.read(path),**kwargs)
end
parse(key, password: nil) click to toggle source

Parses an PEM encoded key.

@param [String] key

The PEM or DER encoded key string.

@param [String, nil] password

Optional password to decrypt the key.

@return [OpenSSL::PKey]

The parsed key.

@api public

# File lib/ronin/support/crypto/key/methods.rb, line 76
def parse(key, password: nil)
  new(key,*password)
end
random(*arguments,&block) click to toggle source

Generates a new random key.

@param [Array] arguments

Additional arguments for `generate`.

@return [Class<Methods>]

The newly generated key.

@note Alias for ‘generate`.

# File lib/ronin/support/crypto/key/methods.rb, line 58
def random(*arguments,&block)
  generate(*arguments,&block)
end