Skip to content

Commit

Permalink
MSYS-857 & MSYS-838 Fixed confirmation popup while installing certifi…
Browse files Browse the repository at this point in the history
…cate in root also fixed certificate be installed in the personal local computer

Signed-off-by: piyushawasthi <[email protected]>
  • Loading branch information
piyushawasthi committed Jul 11, 2018
1 parent a550bf7 commit 7eaf5f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/win32/certstore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def close

# To open certstore and return open certificate store pointer
def open(store_name)
certstore_handler = CertOpenSystemStoreW(nil, wstring(store_name))
certstore_handler = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, nil, CERT_SYSTEM_STORE_LOCAL_MACHINE, wstring(store_name))
unless certstore_handler
last_error = FFI::LastError.error
raise SystemCallError.new("Unable to open the Certificate Store `#{store_name}`.", last_error)
Expand Down
5 changes: 5 additions & 0 deletions lib/win32/certstore/mixin/crypto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ def safe_attach_function(win32_func, *args)
CERT_NAME_SEARCH_ALL_NAMES_FLAG = 0x2
CERT_NAME_STR_ENABLE_PUNYCODE_FLAG = 0x00200000

CERT_STORE_PROV_SYSTEM = 10
CERT_SYSTEM_STORE_LOCAL_MACHINE = 0x00020000

# Define ffi pointer
HCERTSTORE = FFI::TypeDefs[:pointer]
HCRYPTPROV_LEGACY = FFI::TypeDefs[:pointer]
Expand Down Expand Up @@ -172,6 +175,8 @@ class CERT_CONTEXT < FFI::Struct

# To opens the most common system certificate store
safe_attach_function :CertOpenSystemStoreW, [HCRYPTPROV_LEGACY, LPCTSTR], HCERTSTORE
# To open a certificate store for most purposes
safe_attach_function :CertOpenStore, [DWORD, DWORD, HCRYPTPROV_LEGACY, DWORD, LPCTSTR], HCERTSTORE
# To close the already open certificate store
safe_attach_function :CertCloseStore, [HCERTSTORE, DWORD], BOOL
# To create encoded certificate context
Expand Down

0 comments on commit 7eaf5f2

Please sign in to comment.