简体   繁体   English

如何从天青自动化的证书中获取公钥

[英]how to get public key from certificate on azure automation

I need to get SSH public key from the certificate which is store on azure portal and I have created workflow on azure automation and import the certificate to azure portal. 我需要从存储在azure门户上的证书中获取SSH公钥,并且已经在azure自动化上创建了工作流程并将证书导入到azure门户中。 Once we get the SSH public key, I have to create linux VM with this SSH public key(Ready this script from myend without add SSH key). 一旦我们获得了SSH公钥,我就必须使用此SSH公钥创建linux VM(从myend读取此脚本,而无需添加SSH密钥)。

Based on my understanding, your certificate should be DER encoded X.509 certificate with .cer extension. 根据我的理解,您的证书应该是扩展名为.cer的 DER编码X.509证书。

You can get the public key from your certificate using the PowerShell script below: 您可以使用以下PowerShell脚本从证书中获取公钥:

$certPath = "testcert.cer"
$x509Cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::CreateFromCertFile($certPath)
$pk = $x509Cert.GetPublicKeyString()

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从.key文件中提取公钥和私钥? - How to extract public key and private key from .key file? 从.pem文件获取公钥的基于Web的方法 - Web based method to get public key from .pem file 如何通过用户通过ssh发送的公钥获取用户信息? - How to get the user info by the public key the user sent over ssh? 使用来自 Linux 的证书对 Azure 进行身份验证 - Authenticate to Azure with certificate from Linux 从私钥生成公钥 ssh 密钥 - Generate public ssh key from private key 无法连接到 Azure Ubuntu VM - 公钥被拒绝 - Cannot connect to Azure Ubuntu VM - Public Key Denied 如何从脚本添加/替换命令到 SSH 公钥的末尾? - How can I add/replace a command to the end of an SSH public key from script? 如何从unsigned char * modulus和exponent 65537(RSA_F4)创建RSA公钥 - How to create a RSA public key from a unsigned char * modulus and exponent 65537(RSA_F4) openSSL:如何初始化用于公共密钥加密的密钥? - openSSL: how to initialize keys for public key encryption? 如何修复导入证书文件中的“证书导入错误:此客户端证书的私钥丢失或无效”错误 - How to fix ‘Certificate Import Error: The Private Key for this Client Certificate is missing or invalid' error in the import certificate file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM