class Metasploit::Credential::Pkcs12
A private Pkcs12
file.
Public Instance Methods
Source
# File app/models/metasploit/credential/pkcs12.rb, line 55 def adcs_ca metadata['adcs_ca'] end
The CA that issued the certificate
@return [String]
Source
# File app/models/metasploit/credential/pkcs12.rb, line 62 def adcs_template metadata['adcs_template'] end
The certificate template used to issue the certificate
@return [String]
Source
# File app/models/metasploit/credential/pkcs12.rb, line 84 def openssl_pkcs12 if data begin password = metadata.fetch('pkcs12_password', '') OpenSSL::PKCS12.new(Base64.strict_decode64(data), password) rescue OpenSSL::PKCS12::PKCS12Error => error raise ArgumentError.new(error) end end end
Converts the private pkcs12 data in {#data} to an ‘OpenSSL::PKCS12` instance.
@return [OpenSSL::PKCS12] @raise [ArgumentError] if {#data} cannot be loaded
Source
# File app/models/metasploit/credential/pkcs12.rb, line 69 def pkcs12_password metadata['pkcs12_password'] end
The password to decrypt the Pkcs12
@return [String]
Source
# File app/models/metasploit/credential/pkcs12.rb, line 76 def status metadata['status'] end
The status if the certificate (active or inactive)
@return [String]
Source
# File app/models/metasploit/credential/pkcs12.rb, line 99 def to_s return '' unless data cert = openssl_pkcs12.certificate result = [] result << "subject:#{cert.subject.to_s}" result << "issuer:#{cert.issuer.to_s}" result << "ADCS CA:#{metadata['adcs_ca']}" if metadata['adcs_ca'] result << "ADCS template:#{metadata['adcs_template']}" if metadata['adcs_template'] result.join(',') end
The {#data key data}‘s fingerprint, suitable for displaying to the user. The Pkcs12
password is voluntarily not included.
@return [String]
Private Instance Methods
Source
# File app/models/metasploit/credential/pkcs12.rb, line 119 def readable if data begin openssl_pkcs12 rescue => error errors.add(:data, "#{error.class} #{error}") end end end
Validates that {#data} can be read by OpenSSL and a ‘OpenSSL::PKCS12` can be created from {#data}. Any exception raised will be reported as a validation error.
@return [void]