module Win32::Certstore::Mixin::Helper
Public Instance Methods
cert_ps_cmd(thumbprint, store_location: "LocalMachine", store_name: "My")
click to toggle source
# File lib/win32/certstore/mixin/helper.rb, line 24 def cert_ps_cmd(thumbprint, store_location: "LocalMachine", store_name: "My") <<-EOH $cert = Get-ChildItem Cert:\\#{store_location}\\#{store_name} -Recurse | Where { $_.Thumbprint -eq "#{thumbprint}" } $content = $null if($null -ne $cert) { $content = @( '-----BEGIN CERTIFICATE-----' [System.Convert]::ToBase64String($cert.RawData, 'InsertLineBreaks') '-----END CERTIFICATE-----' ) } $content EOH end
valid_duration?(cert_obj)
click to toggle source
validate certificate not_before and not_after date in UTC
# 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