获取https证书的方法

  1. 使用openssl命令
    openssl s_client -connect :
    openssl s_client -connect 10.1.0.1:443
    cer证书以-----BEGIN CERTIFICATE-----开始,
    以-----END CERTIFICATE-----结尾
    复制证书内容到文件即可。命名以 .cer 结尾。


    image.png
root@supsky:/mnt/c/Users/26685# openssl s_client -connect 10.1.0.1:443
CONNECTED(00000003)
Can't use SSL_get_servername
depth=0 C = CN, ST = WH, L = WH, O = , OU = , CN = 
verify error:num=
verify return:
depth=0 C = CN, ST = WH, L = WH, O = , OU = , CN = 
verify error:
verify return:
---
Certificate chain
 0 s:C = CN, ST = WH, L = WH, O = , OU = , CN = 
   i:DC = com, DC = , CN = 
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIGSDCCBTCgAwIBAgITTQAaWfC8MRh9imEY3wAAABpZ8DANBgkqhkiG9w0BAQsF
ADBIMRMwEQYKCZImiZPyLGQBGRYDY29tMRYwFAYKCZImiZPyLGQBGRYGbGVub3Zv
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaAAAAAAAAAAAAAAAA
EwJXSDEPMA0GA1UEChMGTGVub3ZvMQ8wDQYDVQQLEwZMZW5vdm8xFTATBgNVBAMT
DDEwLjEyMi42NC4yMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANmX
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaAAAAAAAAAAAAAAAA
ont1p7E26vHmWJQDRScCAwEAAaOCAxEwggMNMAsGA1UdDwQEAwIFoDAlBgNVHREE
HjAcggwxMC4xMjIuNjQuMjGCDDEwLjEyMi42NC4yMTAdBgNVHQ4EFgQUmFrROv/+
AAAAAAAAAAAAAAAAAAAAAAAAAAA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= WH, O = , OU = , CN = 

issuer=DC = com, DC = , CN = 

---
No client certificate CA names sent
Peer signing digest: 
Peer signature type: 
Server Temp Key: 
---
SSL handshake has read 
Verification error: 
---
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: 
Expansion: 
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 
    Session-ID: 
    Session-ID-ctx:
    Master-Key: 
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint:
    TLS session ticket:

    Start Time: 
    Timeout   : 
    Verify return code: 
    Extended master secret: 
---
closed
root@supsky:/mnt/c/Users/26685#
  1. 从浏览器导出
    此处以网站为例
    F12打开开发者工具-->安全性-->查看证书-->详细信息-->复制到文件-->下一步-->选择Base64编码X.509 -->....-->直到导出即可


    image.png

    image.png

    image.png

你可能感兴趣的:(获取https证书的方法)