NAME
Win32::Crypt::API - Perl interface to functions that assist in working with Microsoft's CryptoAPI
SYNOPSIS
use Win32::Crypt::API;
my $capi = Win32::Crypt::API->new;
DESCRIPTION
Application programming interface that enables application developers to add authentication, encoding, and encryption to Win32-based applications.
METHODS
new
my $capi = Win32::Crypt::API->new;
CERTIFICATE STORE FUNCTIONS
A user site can, over time, collect many certificates. Typically, a site has certificates for the user of the site, and other certificates describing those individuals and entities with whom the user communicates. For each entity, there can be more than one certificate. For each individual certificate, there should be a chain of verifying certificates that provides a trail back to a trusted root certificate. Certificate stores and their related functions provide functionality to store, retrieve, enumerate, verify, and use the information stored in the certificates.
The following functions are used to work with the certificate stores, themselves.
CertAddStoreToCollection
CertCloseStore
CertControlStore
CertDuplicateStore
CertEnumPhysicalStore
CertEnumSystemStore
CertEnumSystemStoreLocation
CertGetStoreProperty
CertOpenStore( lpszStoreProvider, dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara )
The CertOpenStore function opens a certificate store using a specified store provider type. While this function can open a certificate store for most purposes, CertOpenSystemStore is recommended to open the most common certificate stores. CertOpenStore is required for more complex options and special cases.
HCERTSTORE WINAPI CertOpenStore(
LPCSTR lpszStoreProvider,
DWORD dwMsgAndCertEncodingType,
HCRYPTPROV hCryptProv,
DWORD dwFlags,
const void *pvPara
);
- Parameters
-
- lpszStoreProvider
-
Specifies the store provider type. The following predefined store provider types furnish most common application needs.
CERT_STORE_PROV_MEMORY CERT_STORE_PROV_FILENAME CERT_STORE_PROV_SYSTEM CERT_STORE_PROV_PKCS7 CERT_STORE_PROV_SERIALIZED CERT_STORE_PROV_COLLECTION CERT_STORE_PROV_SYSTEM_REGISTRY CERT_STORE_PROV_PHYSICAL CERT_STORE_PROV_SMART_CARD CERT_STORE_PROV_LDAP
The store provider type passed in lpszStoreProvider determines the type of the parameter passed in pvPara and the use and meaning of the high word of the dwFlags parameter.
For more information, please check http://msdn.mircosoft.com.
- dwMsgAndCertEncodingType
-
Applicable only to the CERT_STORE_PROV_PKCS7 or CERT_STORE_PROV_FILENAME provider types. For all other provider types, this parameter is unused and should be set to 0.
Both a certificate and a message encoding type are required for the CERT_STORE_PROV_PKCS7 and CERT_STORE_PROV_FILENAME provider types. The LOWORD specifies the encoding type of certificates, CRLs, and CTLs in the cryptographic message. The HIWORD specifies the encoding type of the message. Encoding types are specified by combining the two encoding types with a bitwise-OR operation.
The most common encoding types are used by passing
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
- hCryptProv
-
Handle to a cryptographic provider. Passing 0 in this parameter causes an appropriate, default provider to be used. Using the default provider is recommended. The default or specified cryptographic provider is used for all store functions that verify the signature of a subject certificate or CRL.
- dwFlags
-
These values consist of high-word and low-word values combined using a bitwise-OR operation. The low-word portion of dwFlags controls a variety of general characteristics of the certificate store opened. This portion can be used with all store provider types. Currently defined low-word values are listed at http://msdn.mircosoft.com.
- pvPara
-
Pointer to a VOID that can point to data of different data types depending on the provider being used. Detailed information about the type and content to be passed in pvPara is specified in the descriptions of the available providers.
- Return Values
-
If the function succeeds, the return value is a handle to the certificate store.
If the function fails, the return value is 0. For extended error information, call Win32::GetLastError().
- Requirements
-
Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.
Windows 95/98/Me: Included in Windows 95 OSR2 and later.
Redistributable: Requires Internet Explorer 3.02 or later on Windows NT 4.0.
CertOpenSystemStore
CertRegisterPhysicalStore
CertRegisterSystemStore
CertRemoveStoreFromCollection
CertSaveStore
CertSetStoreProperty
CertUnregisterPhysicalStore
CertUnregisterSystemStore
SEE ALSO
MSDN Home Page: http://msdn.mircosoft.com
AUTHOR
Sascha Kiefer, esskar@cpan.org
COPYRIGHT AND LICENSE
Copyright (C) 2006 Sascha Kiefer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.