Skip to content

Latest commit

 

History

History
290 lines (145 loc) · 6.87 KB

PyCERTSTORE.md

File metadata and controls

290 lines (145 loc) · 6.87 KB

PyCERTSTORE

PyCERTSTORE Object

Handle to a certificate store

Methods

Properties

  • int HCERTSTORE

    Integer handle

PyCERTSTORE.CertAddCTLContextToStore

PyCTL_CONTEXT = CertAddCTLContextToStore(CtlContext, AddDisposition

) Adds a certificate trust list to the store

Parameters

  • CtlContext : PyCTL_CONTEXT

    CTL to be added

  • AddDisposition : int

    CERT_STORE_ADD_* constant

PyCERTSTORE.CertAddCTLLinkToStore

PyCTL_CONTEXT = CertAddCTLLinkToStore(CtlContext, AddDisposition

) Adds a link to a CTL in another store

Parameters

  • CtlContext : PyCTL_CONTEXT

    CTL to be linked

  • AddDisposition : int

    One of the CERT_STORE_ADD_* values

PyCERTSTORE.CertAddCertificateContextToStore

PyCERT_CONTEXT = CertAddCertificateContextToStore(CertContext, AddDisposition

) Adds a certificate context to the store

Parameters

  • CertContext : PyCERT_CONTEXT

    Certificate context to be added

  • AddDisposition : int

    CERT_STORE_ADD_* constant

PyCERTSTORE.CertAddCertificateLinkToStore

PyCERT_CONTEXT = CertAddCertificateLinkToStore(CertContext, AddDisposition

) Adds a link to a cert in another store

Parameters

  • CertContext : PyCERT_CONTEXT

    Certificate context to be linked

  • AddDisposition : int

    One of the CERT_STORE_ADD_* values

PyCERTSTORE.CertAddEncodedCertificateToStore

PyCERT_CONTEXT = CertAddEncodedCertificateToStore(CertEncodingType, CertEncoded

, AddDisposition

) Imports an encoded certificate into the store

Parameters

  • CertEncodingType : int

    Usually X509_ASN_ENCODING combined with PKCS_7_ASN_ENCODING

  • CertEncoded : buffer

    Data containing a serialized certificate

  • AddDisposition : int

    Combination of CERT_STORE_ADD_* flags

PyCERTSTORE.CertAddStoreToCollection

CertAddStoreToCollection(SiblingStore, UpdateFlag, Priority) Adds a sibling store to a store collection

Parameters

  • SiblingStore : PyCERTSTORE

    Store to be added to the collection

  • UpdateFlag=0 : int

    Can be CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG to enable changes to persist

  • Priority=0 : int

    Determines order in which store are searched and updated

Comments

A collection store is created by using cryptoapi::CertOpenStore

with CERT_STORE_PROV_COLLECTION

PyCERTSTORE.CertCloseStore

CertCloseStore(Flags) Closes the certificate store

Parameters

  • Flags=0 : int

    Combination of CERT_CLOSE_*_FLAG flags

PyCERTSTORE.CertControlStore

CertControlStore(Flags, CtrlType, CtrlPara) Controls sychronization of the certificate store

Parameters

  • Flags : int

    One of the CERT_STORE_CTRL_*_FLAG flags

  • CtrlType : int

    One of the CERT_STORE_CTRL_* flags

  • CtrlPara : PyHANDLE

    Event handle, can be None (not used with CERT_STORE_CTRL_COMMIT)

PyCERTSTORE.CertEnumCTLsInStore

[PyCTL_CONTEXT,...] = CertEnumCTLsInStore() Finds all Certificate Trust Lists in store

PyCERTSTORE.CertEnumCertificatesInStore

[PyCERT_CONTEXT,...] = CertEnumCertificatesInStore() Lists all certificates in the store

PyCERTSTORE.CertRemoveStoreFromCollection

CertRemoveStoreFromCollection(SiblingStore) Removes a sibling store from a collection

Parameters

  • SiblingStore : PyCERTSTORE

    Store to be removed from the collection

PyCERTSTORE.CertSaveStore

CertSaveStore(MsgAndCertEncodingType, SaveAs, SaveTo, SaveToPara, Flags) Serializes the store to memory or a file

Parameters

  • MsgAndCertEncodingType : int

    Only used when saveas is CERT_STORE_SAVE_AS_PKCS7 - usually X509_ASN_ENCODING combined with PKCS_7_ASN_ENCODING

  • SaveAs : int

    One of the CERT_STORE_SAVE_AS_* constants

  • SaveTo : int

    One of the CERT_STORE_SAVE_TO_* constants (CERT_STORE_SAVE_TO_MEMORY not supported yet)

  • SaveToPara : PyHANDLE/string

    File name or open file handle depending on SaveTo parm

  • Flags=0 : int

    Reserved, use 0

PyCERTSTORE.PFXExportCertStoreEx

bytes = PFXExportCertStoreEx(Password, Flags

) Exports certificates and associated private keys in PKCS#12 format

Parameters

  • Password=None : str

    Passphrase to be used to encrypt the output

  • Flags=EXPORT_PRIVATE_KEYS|REPORT_NO_PRIVATE_KEY|REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY : int

    Options to be used while exporting