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_name) ⇒ Object
PSCommand to search certificate from thumbprint and convert in pem.
-
#valid_duration?(cert_obj) ⇒ Boolean
validate certificate not_before and not_after date in UTC.
Instance Method Details
#cert_ps_cmd(thumbprint, store_name) ⇒ Object
PSCommand to search certificate from thumbprint and convert in pem
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/win32/certstore/mixin/helper.rb', line 26 def cert_ps_cmd(thumbprint, store_name) " $content = $null\n $cert = Get-ChildItem Cert:\\\\LocalMachine\\\\'\#{store_name}' -Recurse | Where { $_.Thumbprint -eq '\#{thumbprint}' }\n if($cert -ne $null)\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
43 44 45 |
# File 'lib/win32/certstore/mixin/helper.rb', line 43 def valid_duration?(cert_obj) cert_obj.not_before < Time.now.utc && cert_obj.not_after > Time.now.utc end |