C# Class PInvoke.Crypt32

ファイルを表示 Open project: AArnott/pinvoke

Public Methods

Method Description
CryptAcquireCertificatePrivateKey ( IntPtr pCert, CryptAcquireCertificatePrivateKeyFlags dwFlags, IntPtr pvParameters, SafeHandle &cryptHandle ) : bool

Obtains the private key for a certificate. This function is used to obtain access to a user's private key when the user's certificate is available, but the handle of the user's key container is not available. This function can only be used by the owner of a private key and not by any other user. If a CSP handle and the key container containing a user's private key are available, the CryptGetUserKey function should be used instead.

Private Methods

Method Description
CertCloseStore ( IntPtr hCertStore, CertCloseStoreFlags dwFlags = CertCloseStoreFlags.None ) : bool
CertGetCertificateContextProperty ( IntPtr pCertContext, CERT_PROP_ID dwPropId, void pvData, int &pcbData ) : bool
CryptAcquireCertificatePrivateKey ( IntPtr pCert, CryptAcquireCertificatePrivateKeyFlags dwFlags, void pvParameters, IntPtr &phCryptProvOrNCryptKey, uint &pdwKeySpec, [ pfCallerFreeProvOrNCryptKey ) : bool
PFXImportCertStore ( CRYPT_DATA_BLOB &pPFX, string szPassword, PFXImportCertStoreFlags dwFlags ) : SafeCertStoreHandle

Method Details

CryptAcquireCertificatePrivateKey() public static method

Obtains the private key for a certificate. This function is used to obtain access to a user's private key when the user's certificate is available, but the handle of the user's key container is not available. This function can only be used by the owner of a private key and not by any other user. If a CSP handle and the key container containing a user's private key are available, the CryptGetUserKey function should be used instead.
public static CryptAcquireCertificatePrivateKey ( IntPtr pCert, CryptAcquireCertificatePrivateKeyFlags dwFlags, IntPtr pvParameters, SafeHandle &cryptHandle ) : bool
pCert System.IntPtr The address of a CERT_CONTEXT structure that contains the certificate context for which a private key will be obtained.
dwFlags CryptAcquireCertificatePrivateKeyFlags A set of flags that modify the behavior of this function. This can be zero or a combination of one or more of values.
pvParameters System.IntPtr /// If the is set, then this is the address of an HWND. If the is not set, then this parameter must be NULL. /// Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP: This parameter was named pvReserved and reserved for future use and must be NULL. ///
cryptHandle System.Runtime.InteropServices.SafeHandle /// Receives a safe handle to either CNG key handle of type NCRYPT_KEY_HANDLE or CryptoAPI provider handle of type HCRYPTPROV. ///
return bool