Skip to content

Commit dd9a809

Browse files
committed
Add CertificateStore.from_user_store
1 parent 596ab22 commit dd9a809

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

windows/crypto/certificate.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ def from_system_store(cls, store_name):
152152
res = winproxy.CertOpenStore(gdef.CERT_STORE_PROV_SYSTEM_A, DEFAULT_ENCODING, None, gdef.CERT_SYSTEM_STORE_LOCAL_MACHINE | gdef.CERT_STORE_READONLY_FLAG, store_name)
153153
return ctypes.cast(res, cls)
154154

155+
@classmethod
156+
def from_user_store(cls, store_name, user=True):
157+
"""Create a new :class:`CertificateStore` from system store ``store_name``
158+
(see `System Store Locations <https://msdn.microsoft.com/en-us/library/windows/desktop/aa388136(v=vs.85).aspx>`_)
159+
"""
160+
res = winproxy.CertOpenStore(gdef.CERT_STORE_PROV_SYSTEM_A, DEFAULT_ENCODING, None, gdef.CERT_SYSTEM_STORE_CURRENT_USER | gdef.CERT_STORE_READONLY_FLAG, store_name)
161+
return ctypes.cast(res, cls)
162+
155163
@classmethod
156164
def new_in_memory(cls):
157165
"""Create a new temporary :class:`CertificateStore` in memory"""

0 commit comments

Comments
 (0)