Openssl从证书中获取公钥

1
openssl x509 -in ca.crt -pubkey

其中 -in 为输入文件名

结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvLgG+bUnsMJCgAf/lGWh
2vqn3ZgoKHwERvgVmgCdn8LPUwc2/kGf6ucmkHKE+VcZ7qQg7A/2K8PyDvs3K+qS
SpkyeC0lhaUxYFJGmSjdeqDkLF+fJ5DcTgqi9sJJfozQN2Uk5ppsN76t4BEW7IW/
a8NReMJ18iB3H18wcJQS0ml4pf/O5h3YxArbGl5LE2sWVRFvE9cSn/Vi+zjMP4e8
FIMWi6snIhQpXUMQmP7ecCfzEAEtfVDEXa2Dzka+FJpnJNJ2nQXJIEWF55YOOe1D
4gJAl9qsI8cVEnZK3fseqHpZ8kKY2SuGyNlsgEf7+DfUT/m3Igg+n2MsoxndtOUi
GwIDAQAB
-----END PUBLIC KEY-----
-----BEGIN CERTIFICATE-----
MIIEnjCCA4agAwIBAgIJAN7TiN2CbZx9MA0GCSqGSIb3DQEBCwUAMIGQMQswCQYD
VQQGEwJDTjESMBAGA1UECBMJR3Vhbmdkb25nMRIwEAYDVQQHEwlHdWFuZ3pob3Ux
EjAQBgNVBAoTCU9wZW5UQ0dBQTELMAkGA1UECxMCQ0ExFTATBgNVBAMTDE9wZW5U
Q0dBQSBDQTEhMB8GCSqGSIb3DQEJARYSaW5mb0BvcGVudGNnYWEub3JnMB4XDTE1
MTAyNzAxNTk0MVoXDTI1MTAyNDAxNTk0MVowgZAxCzAJBgNVBAYTAkNOMRIwEAYD
VQQIEwlHdWFuZ2RvbmcxEjAQBgNVBAcTCUd1YW5nemhvdTESMBAGA1UEChMJT3Bl
blRDR0FBMQswCQYDVQQLEwJDQTEVMBMGA1UEAxMMT3BlblRDR0FBIENBMSEwHwYJ
KoZIhvcN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