douzhou7037 2019-06-20 19:50
浏览 115
已采纳

AWS Cert Mgr-如何创建客户端和设备证书?

From AWS tech talk, I have learnt that,

enter image description here

I am able to create private server certificate using below option:

enter image description here

-------------------

The server certificates serve the rationale of encrypting and decrypting the content.

Whereas

client certificate as the name implies is clearly used to identify a client to a respective user

A device certificate creates an identity for each “thing” in an IoT ecosystem, making sure each device authenticates as it connects, and protects communication between devices.


We have created root CA and subordinate CA using AWS Cert mgr through console.

How to create device & client certificate(private) using ACM GoLang sdk?

  • 写回答

1条回答 默认 最新

  • douliu3831 2019-06-20 20:13
    关注

    [UPDATE after question asked for ACM]

    Use the aws acm-pca issue-certificate command to request a certificate:

    CLIENT_ID="device-0001"
    CLIENT_SERIAL=0001
    
    # Create the CSR and Private Key
    openssl req -new -newkey rsa:2048 -days 365 -keyout ${CLIENT_ID}.key -out ${CLIENT_ID}.csr
    
    # Replace --certificate-authority-arn with your ARN returned when you create the certificate authority.
    
    aws acm-pca issue-certificate \
    --csr file://${CLIENT_ID}.csr \
    --signing-algorithm "SHA256WITHRSA" \
    --validity Value=375,Type="DAYS" \
    --idempotency-token 12983 \
    --certificate-authority-arn arn:aws:acm-pca:region:account:\
    certificate-authority/12345678-1234-1234-1234-123456789012
    

    This command outputs the ARN, save this value for the next command ($MY-CERT-ARN)

    aws acm-pca get-certificate \
    --certificate-authority-arn arn:aws:acm-pca:region:account:\
    certificate-authority/12345678-1234-1234-1234-123456789012 \
    --certificate-arn $MY-CERT-ARN \
     --output text > ${CLIENT_ID}-cert.pem
    

    [END UPDATE]

    Example code to generate a client certificate. Change CLIENT_ID and CLIENT_SERIAL for each certificate that you generate. ca.pem and ca.key are your CA certificate and private key.

    CLIENT_ID="device-0001"
    CLIENT_SERIAL=0001
    
    openssl genrsa -aes256 -passout pass:xxxx -out ${CLIENT_ID}.pass.key 4096
    openssl rsa -passin pass:xxxx -in ${CLIENT_ID}.pass.key -out ${CLIENT_ID}.key
    rm ${CLIENT_ID}.pass.key
    
    # generate the CSR
    openssl req -new -key ${CLIENT_ID}.key -out ${CLIENT_ID}.csr
    
    # issue this certificate, signed by the CA (ca.pem ca.key)
    openssl x509 -req -days 375 -in ${CLIENT_ID}.csr -CA ca.pem -CAkey ca.key -set_serial ${CLIENT_SERIAL} -out ${CLIENT_ID}.pem
    
    # Give the client the file: ${CLIENT_ID}.full.pem
    cat ${CLIENT_ID}.key ${CLIENT_ID}.pem ca.pem > ${CLIENT_ID}.full.pem
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 复现论文:matlab仿真代码编写
  • ¥15 esp32驱动GC9A01循环播放视频
  • ¥15 惠普360g9的最新bios
  • ¥30 这个功能用什么软件发合适?
  • ¥60 微信小程序,取消订单,偶尔订单没有改变状态
  • ¥15 用pytorch实现PPO算法
  • ¥15 关于调制信号的星座图?
  • ¥30 前端传参时,后端接收不到参数
  • ¥15 这是有什么问题吗,我检查许可证了但是显示有呢
  • ¥15 机器学习预测遇到的目标函数问题