Module: Win32::Certstore::Mixin::Helper
- Included in:
- StoreBase
- Defined in:
- lib/win32/certstore/mixin/helper.rb
Instance Method Summary collapse
- #cert_ps_cmd(thumbprint, store_location: "LocalMachine", store_name: "My") ⇒ Object
-
#valid_duration?(cert_obj) ⇒ Boolean
validate certificate not_before and not_after date in UTC.
Instance Method Details
#cert_ps_cmd(thumbprint, store_location: "LocalMachine", store_name: "My") ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/win32/certstore/mixin/helper.rb', line 24 def cert_ps_cmd(thumbprint, store_location: "LocalMachine", store_name: "My") " $cert = Get-ChildItem Cert:\\\\\#{store_location}\\\\\#{store_name} -Recurse | Where { $_.Thumbprint -eq \"\#{thumbprint}\" }\n\n $content = $null\n if($null -ne $cert)\n {\n $content = @(\n '-----BEGIN CERTIFICATE-----'\n [System.Convert]::ToBase64String($cert.RawData, 'InsertLineBreaks')\n '-----END CERTIFICATE-----'\n )\n }\n $content\n EOH\nend\n" |
#valid_duration?(cert_obj) ⇒ Boolean
validate certificate not_before and not_after date in UTC
42 43 44 |
# File 'lib/win32/certstore/mixin/helper.rb', line 42 def valid_duration?(cert_obj) cert_obj.not_before < Time.now.utc && cert_obj.not_after > Time.now.utc end |