win32-certstore 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b07544eeb10d6d5d218064ac922283b7654a4e6a683999f645792ff27fa45d5
4
- data.tar.gz: c7be876bba7975484a85507e241d9d8f6c590194ea32290edc5189540e647f69
3
+ metadata.gz: 7498d33d838e240261d6629228c9e5f4135cbc8cfef53dd6eb2c25fd15cfa04f
4
+ data.tar.gz: 7ebbfe860ed3109d18bf6cedb18040fec935a82985348317a9513e6803b80f1e
5
5
  SHA512:
6
- metadata.gz: 772ca2195c9e4aa5b522d2e1196730cfc3cb777a05779c99d17a770eae954280e5a555986ee8718fbf785a94d9490b55b419515548c0740ed7f08f20839cf43b
7
- data.tar.gz: 167436e45e6ae7b64cd4de5ce95eced68d7b16ed759585b3bd5a682a6f63b6c8b26c31c13c59e448006a6bb298ce89986bb33d987efcbbaee3959f6542ff733f
6
+ metadata.gz: 6bcf63bbce574b4c92224c1228b7abd68a9e15bd527ffaafd3750f14bb106a499d03eabef6fd134ee603fa790230c12161f0a64ed7e6a072a3f4135da1cfe8db
7
+ data.tar.gz: e58963b69cc9e20d7b31316e2a1cc2b00484489ea85a8796115555bc2dd40875f55a2327bcddd067c8c8e985096228b2835f3709233aa04a23174027dc8015e7
@@ -63,16 +63,17 @@ module Win32
63
63
  # @raise [SystemCallError] when Crypt API would not be able to perform some action
64
64
  #
65
65
  def cert_add_pfx(certstore_handler, path, password = "")
66
+ cert_added = false
66
67
  # Imports a PFX BLOB and returns the handle of a store
67
68
  pfx_cert_store = PFXImportCertStore(CRYPT_DATA_BLOB.new(File.binread(path)), wstring(password), 0)
68
69
  raise if pfx_cert_store.null?
69
- # Find the certificate context in certificate store
70
- cert_context = CertFindCertificateInStore(pfx_cert_store, ENCODING_TYPE, 0, CERT_FIND_ANY, nil, nil)
71
- raise if cert_context.null?
72
- # Add certificate context to the certificate store
73
- args = add_certcontxt_args(certstore_handler, cert_context)
74
- cert_added = CertAddCertificateContextToStore(*args)
75
- raise unless cert_added
70
+ # Find all the certificate contexts in certificate store and add them ino the store
71
+ while (cert_context = CertEnumCertificatesInStore(pfx_cert_store, cert_context)) && (not cert_context.null?)
72
+ # Add certificate context to the certificate store
73
+ args = add_certcontxt_args(certstore_handler, cert_context)
74
+ cert_added = CertAddCertificateContextToStore(*args)
75
+ raise unless cert_added
76
+ end
76
77
  cert_added
77
78
  rescue
78
79
  lookup_error("Add a PFX")
@@ -1,6 +1,6 @@
1
1
  module Win32
2
2
  class Certstore
3
- VERSION = "0.2.4".freeze
3
+ VERSION = "0.3.0".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.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-04 00:00:00.000000000 Z
11
+ date: 2019-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler