Class: Metasploit::Credential::Pkcs12
- Defined in:
- app/models/metasploit/credential/pkcs12.rb
Overview
A private Pkcs12 file.
Instance Attribute Summary collapse
-
#data ⇒ String
A private pkcs12 file, base64 encoded - i.e.
Attributes inherited from Private
#cores, #created_at, #id, #type, #updated_at
Instance Method Summary collapse
-
#openssl_pkcs12 ⇒ OpenSSL::PKCS12
Converts the private pkcs12 data in #data to an ‘OpenSSL::PKCS12` instance.
-
#to_s ⇒ String
The key data‘s fingerprint, suitable for displaying to the user.
Instance Attribute Details
#data ⇒ String
A private pkcs12 file, base64 encoded - i.e. starting with ‘MIIMhgIBAzCCDFAGCSqGSIb3DQEHAaCC.…’
|
# File 'app/models/metasploit/credential/pkcs12.rb', line 10
|
Instance Method Details
#openssl_pkcs12 ⇒ OpenSSL::PKCS12
Converts the private pkcs12 data in #data to an ‘OpenSSL::PKCS12` instance.
41 42 43 44 45 46 47 48 49 50 |
# File 'app/models/metasploit/credential/pkcs12.rb', line 41 def openssl_pkcs12 if data begin password = '' OpenSSL::PKCS12.new(Base64.strict_decode64(data), password) rescue OpenSSL::PKCS12::PKCS12Error => error raise ArgumentError.new(error) end end end |
#to_s ⇒ String
The key data‘s fingerprint, suitable for displaying to the user.
56 57 58 59 60 61 62 63 64 |
# File 'app/models/metasploit/credential/pkcs12.rb', line 56 def to_s return '' unless data cert = openssl_pkcs12.certificate result = [] result << "subject:#{cert.subject.to_s}" result << "issuer:#{cert.issuer.to_s}" result.join(',') end |