大网数据广告活动
数据库与应用安全

Use PFX-formatted certificates

· 52CE 我爱测

This article describes the Microsoft PVKConverter for SQL Server tool. This tool supports the conversion of a certificate that uses the PFX format into PVK/DER format.

This article introduces the Microsoft PVKConverter for SQL Server tool. This tool supports the conversion of a certificate that uses the PFX format into PVK/DER format. In SQL Server 2022 (16.x) or later versions, certificates with private keys can be backed up or restored directly to and from files or binary blobs using the public key pairs (PKCS) #12 or personal information exchange (PFX) format. For more information, see CREATE CERTIFICATE (Transact-SQL).

Original product version:   SQL Server
Original KB number:   2914662

Summary

To use certificates that are in the PFX format in Microsoft SQL Server, use Microsoft PVKConverter for SQL Server to convert the PFX certificate files into PVK/DER format. To do this, follow these steps:

  1. Download and install the following tool:

    Microsoft PVKConverter for SQL Server

  2. Run the following command at a command prompt:

    PVKConverter.exe -i <PFX format file> -o <PVK/DER format file> -d <Decryption password> -e <Encryption password>
    

    This step processes a PFX certificate file in order to generate the following PVK/DER certificate pairs:

    • <PVK/DER format file>_1.cer
    • <PVK/DER format file>_2.cer and <PVK/DER format file>_2.pvk

    [!NOTE] The number of PVK/DER files that are generated depends on the number of public/private key pairs that are contained in the PFX file. One PVK/DER file pair is generated for each public/private key pair.

  3. Run the following Transact-SQL script:

    CREATE CERTIFICATE <Certificate name>
     FROM FILE = '<PVK/DER format file>.cer'
     WITH PRIVATE KEY (FILE = '<PVK/DER format file>.pvk',
     DECRYPTION BY PASSWORD = '<Encryption password>');
    

    [!NOTE] The Encryption password placeholder represents the password that is provided through the -e option of PVKConverter.exe.

More information

SQL Server supports the importing of existing security certificates that are specified as a pair of files that are encoded in PVK/DER format. The PVK file contains information about the certificate's private key, and the DER file contains the remaining information.

Windows Certificate Manager supports the export to PFX format only of existing certificates that contain private key information in Windows 2008. Windows 2008 has discontinued support for exporting to PVK/DER format. On the other hand, SQL Server does not support the importing of PFX encoded certificates. Therefore, there is currently an interoperability issue between Windows Certificate Manager and SQL Server.

Note: If the serial number of your certificate is greater than 16 bytes, see the following article for your version of SQL Server.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 06/18/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。