Skip to content

Commit

Permalink
Updated the references to the ChefPowerShell gem which had its classe…
Browse files Browse the repository at this point in the history
…s renamed to remove a hyphen. All tests are passing

Signed-off-by: John McCrae <[email protected]>
  • Loading branch information
johnmccrae committed Jan 13, 2022
1 parent 9e8c243 commit 6d0b40f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/win32/certstore/store_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module StoreBase
include Win32::Certstore::Mixin::String
include Win32::Certstore::Mixin::Unicode
include Win32::Certstore::Mixin::Helper
include Chef_PowerShell::ChefPowerShell::PowerShellExec
include ChefPowerShell::ChefPowerShellModule::PowerShellExec

# Adding new certification in open certificate and return boolean
# store_handler => Open certificate store handler
Expand Down Expand Up @@ -173,7 +173,7 @@ def cert_search(store_handler, search_token)
certificate_list
end

# how can I find a cert if I don't have the thumbprint?
# how can I find a cert if I don't have the thumbprint? This should be replaced by a call to CertFindCertificateInStore
def cert_lookup_by_token(search_token, store_name: @store_name, store_location: @store_location, timeout: -1)
raise ArgumentError, "Invalid search token" if !search_token || search_token.strip.empty?

Expand All @@ -189,7 +189,7 @@ def cert_lookup_by_token(search_token, store_name: @store_name, store_location:

powershell_exec!(powershell_cmd, :powershell, timeout: timeout).result

rescue Chef_PowerShell::PowerShellExceptions::PowerShellCommandFailed
rescue ChefPowerShell::PowerShellExceptions::PowerShellCommandFailed
raise ArgumentError, "Certificate not found while looking for certificate : #{search_token} in store : #{store_name} at this location : #{store_location}"
end

Expand Down Expand Up @@ -255,7 +255,7 @@ def der_cert(cert_obj)
FFI::MemoryPointer.from_string(cert_obj.to_der)
end

# Get certificate pem
# Get certificate pem.
def get_cert_pem(thumbprint, store_name: @store_name, store_location: @store_location, timeout: -1)
converted_store = if store_location == CERT_SYSTEM_STORE_LOCAL_MACHINE || store_location == 131072
"LocalMachine"
Expand All @@ -264,7 +264,7 @@ def get_cert_pem(thumbprint, store_name: @store_name, store_location: @store_loc
end
get_data = powershell_exec!(cert_ps_cmd(thumbprint, store_location: converted_store, store_name: store_name), :powershell, timeout: timeout)
get_data.result
rescue Chef_PowerShell::PowerShellExceptions::PowerShellCommandFailed
rescue ChefPowerShell::PowerShellExceptions::PowerShellCommandFailed
raise ArgumentError, "PowerShell threw an error retreiving the certificate. You asked for a cert with this thumbprint : #{thumbprint}, located in this store : #{store_name}, at this location : #{store_location}"
end

Expand Down
2 changes: 1 addition & 1 deletion win32-certstore.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rspec", "~> 3.0"

spec.add_dependency "ffi"
spec.add_runtime_dependency "chef-powershell"
spec.add_runtime_dependency "chef-powershell", '>= 1.0.11'
spec.metadata["yard.run"] = "yri"
end

0 comments on commit 6d0b40f

Please sign in to comment.