我正在尝试使用 Powershell 从证书中提取公钥。但是,每当我使用 Powershell 命令时 Get-PfxCertificate
它只输出证书的指纹而不是公钥。我怎样才能让它输出公钥?
最佳答案
要使用 Powershell 从 PFX 证书中检索公钥,请使用以下命令:
(Get-PfxCertificate -FilePath mycert.pfx).GetPublicKey()
要将公钥转换为不带连字符的十六进制字符串,您可以使用以下命令:
[System.BitConverter]::ToString((Get-PfxCertificate -FilePath mycert.pfx).GetPublicKey()).Replace("-", "")
关于powershell - 如何使用 Powershell 从 PFX 证书获取公钥?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38134750/