PVKFileName

Historically, Authenticode has exported the private key to a .pvk file on a disk and removed the keys from the registry. By default, private keys are not generated for exportation, and many cryptographic service providers do not support exporting keys. However, if the cryptographic service provider (CSP) can support exporting private keys, setting the PVKFileName property will attempt to generate the private keys as exportable. Setting the property will also write the private and public key to the file specified by the PVKFileName property. As a byproduct, the private key is removed from the CSP. The filename specified by the property can be any accessible file. By default, no .pvk file is generated and the keys are not generated as exportable.

If the .pvk file already exists, the user is notified and prompted for permission to overwrite.

Note  The GenKeyFlags property also has a flag that controls whether the private key can be exported. Use care when utilizing the GenKeyFlags property and the PVKFileName property together. If the PVKFileName property is set first, the GenKeyFlags property is automatically set to CRYPT_EXPORTABLE. If the GenKeyFlags property is set (using the put_GenKeyFlags function) in this case without setting CRYPT_EXPORTABLE flag, then the GenKeyFlags will not be set to CRYPT_EXPORTABLE and the generated keys will not be exportable. The following example demonstrates this:

  1. Call put_PVKFileName to set the filename for the file that will receive the exported keys. The GenKeyFlags property is automatically set to CRYPT_EXPORTABLE.
  2. Call put_GenKeyFlags with a value not set to CRYPT_EXPORTABLE; for example, zero.
  3. GenKeyFlags is no longer set to CRYPT_EXPORTABLE (the value that was automatically set in step one).

Any keys generated following the previous steps will be not exportable. Therefore, it is recommended that the user set the GenKeyFlags property before the PVKFileName property when they are used together.

Alternatively, the user could determine the current value of the CRYPT_EXPORTABLE bit in the GenKeyFlags property, and then OR this value into any changes that are made to the GenKeyFlags property to ensure that the bit is not wiped out. The user could also specifically set the CRYPT_EXPORTABLE bit when updating the GenKeyFlags property.

Data Type

[VB] BSTR
[C++] BSTR

Defined Values

Any valid filename supported by the operating system in use.

Affects the behavior of the following methods:

createPKCS10
createFilePKCS10

Access Methods

[VB] "="operator
[C++] HRESULT get_PVKFileName (BSTR);
HRESULT put_PVKFileName (BSTR);

HRESULT

Value Meaning
S_OK The property read/write completed successfully.