Method: Metasploit::Credential::Pkcs12#openssl_pkcs12

Defined in:
app/models/metasploit/credential/pkcs12.rb

#openssl_pkcs12OpenSSL::PKCS12

Converts the private pkcs12 data in #data to an ‘OpenSSL::PKCS12` instance.

Returns:

  • (OpenSSL::PKCS12)

Raises:

  • (ArgumentError)

    if #data cannot be loaded



84
85
86
87
88
89
90
91
92
93
# File 'app/models/metasploit/credential/pkcs12.rb', line 84

def openssl_pkcs12
  if data
    begin
      password = .fetch('pkcs12_password', '')
      OpenSSL::PKCS12.new(Base64.strict_decode64(data), password)
    rescue OpenSSL::PKCS12::PKCS12Error => error
      raise ArgumentError.new(error)
    end
  end
end