win32-certstore 0.6.12 → 0.6.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4a48182fe9aada5c09a9e0205bc5a3a53fd1b50da8fa3a5abfd649adce8fac0
4
- data.tar.gz: 2803b6ddc28e7575f2c9f3709c42e8509c42cef7c5b6ca9e85884dd51be14dd9
3
+ metadata.gz: cc1e81bec9382196d23ef1bd3cd6c344e9b86052387d1b2682172ec38e11289c
4
+ data.tar.gz: ccf51ca4d89cab428740dfdb2befb578936cea342251cafa03a07b57a657d90a
5
5
  SHA512:
6
- metadata.gz: b4569f5dcf1f73d12dd9d82515b2ee0f2d270488118c0c0f0b7f4f079ba7c65cc8dcf7e1321221c68f4465c4858195c752a78c19de3345e795b618ecab616e4f
7
- data.tar.gz: c0d0e669883c027786d41eea3eea9b85c66bc7391675f63a60c8f5229115b73a2e617268a415d741d164a3621688c98902871d1eb764e4c07c2b5ef88a4f3aa8
6
+ metadata.gz: bb20d4faed9a9325bbea782ac186317627f55ca14c2bcedcee8ad0424510a06649836f4f97c5727d2eb3d01e698ea4935b7debee016449fe8bf2df417d7d8531
7
+ data.tar.gz: b0bed942d330d7ed0e86132c0f1172deb28877648ebc431da7922a8ad8e73898580ed909852ca5a646c8c1f6f1ea8912cf4717ade0d528d07ff2236652fe35a4
@@ -43,7 +43,7 @@ module Win32
43
43
 
44
44
  # Validate thumbprint
45
45
  def validate_thumbprint(cert_thumbprint)
46
- if cert_thumbprint.nil? || cert_thumbprint.empty? || cert_thumbprint.strip.empty?
46
+ if cert_thumbprint.nil? || cert_thumbprint.empty? || cert_thumbprint.strip.empty? || cert_thumbprint.length < 40
47
47
  raise ArgumentError, "Invalid certificate thumbprint."
48
48
  end
49
49
  end
@@ -24,7 +24,11 @@ module Win32
24
24
  def cert_ps_cmd(thumbprint, store_location: "LocalMachine", store_name: "My")
25
25
  # the PowerShell block below uses a "Here-String" - it is explicitly formatted against the left margin.
26
26
  <<-EOH
27
- $cert = Get-ChildItem Cert:\\#{store_location}\\#{store_name} -Recurse | Where-Object { $_.Thumbprint -eq "#{thumbprint}" }
27
+ $cert = Get-ChildItem Cert:\\#{store_location}\\#{store_name} -Recurse -Force | Where-Object { $_.Thumbprint -eq "#{thumbprint}" }
28
+
29
+ if ([string]::IsNullOrEmpty($cert)){
30
+ return "Certificate Not Found"
31
+ }
28
32
 
29
33
  $certdata = [System.Convert]::ToBase64String($cert.RawData, 'InsertLineBreaks')
30
34
  $content = $null
@@ -96,6 +96,7 @@ module Win32
96
96
  validate_thumbprint(certificate_thumbprint)
97
97
  thumbprint = update_thumbprint(certificate_thumbprint)
98
98
  cert_pem = get_cert_pem(thumbprint)
99
+ return cert_pem if cert_pem == "Certificate Not Found"
99
100
  cert_pem = format_pem(cert_pem)
100
101
  verify_certificate(cert_pem)
101
102
  build_openssl_obj(cert_pem)
@@ -1,6 +1,6 @@
1
1
  module Win32
2
2
  class Certstore
3
- VERSION = "0.6.12".freeze
3
+ VERSION = "0.6.15".freeze
4
4
  MAJOR, MINOR, TINY = VERSION.split(".")
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-certstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.6.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-15 00:00:00.000000000 Z
11
+ date: 2022-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler