formati di chiave pubblica [chiuso]

0

Ho la seguente chiave pubblica in formato PEM:

   -----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDguwHaldTclMAFg1BQ45Q8DPIc
8Su5mwoyGuf8bHIrgV3gz18YgQl+Puvc7Ua63S1o1s/tkDbfdAWweArO+KdOMrEg
dsB9PdgMuAeAb3TN4Tc4rOe+N0mG7hBiigMaG2E5zdcwDe7d2q5Sa0rjCGCnLbNF
zmGIsHtzogq4lOrJ2QIDAQAB
-----END PUBLIC KEY-----

Ho anche la seguente versione di questo:

MIICsDCCAhmgAwIBAgIJAMqzfnyqYsh+MA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQwHhcNMTQwNTEyMTMxODQ2WhcNMjQwNTA5MTMxODQ2WjBF
MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
gQDCYRMCJU7mW1Dy3Tkkmya3uARqFKZGcIgMgTi9M78Uyh1WOB+rBvhvCGSk1gcw
g1Ws8OL2fzWtvxLx4hb4+kyIXi8hQR+T1DeWdGxKKQ26zyA7678Ko5SoS06KvYK8
CNU5IXb9NGMHHWg8ilQoYyHZSZmROXOQPOGx0HR/wGrCeQIDAQABo4GnMIGkMB0G
A1UdDgQWBBQL826oByHeQ2eKfSW++K9yY3J51zB1BgNVHSMEbjBsgBQL826oByHe
Q2eKfSW++K9yY3J516FJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt
U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMqzfnyq
Ysh+MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAK0tQ6nEBxpVUWH+Q
/uz6CGggMVCe9ZiHw+OfEEazYXSimxFiy9DYpI2D4xuEBoEfLPugfzzVF94FNccV
5mm0yrncUA7D6vwoC9XYjX1SfhxR44jJml43Uj49osYNFoSGcSFkspI6/7TujPsP
qtxmmkWXATVV6kR4z9BwXEAnpr0=

qualcuno può riconoscere il formato di quest'ultimo?

    
posta Onoma 24.02.2015 - 09:07
fonte

1 risposta

1

È un certificato PEM che ha perso le intestazioni. OpenSSL leggerà se si aggiungono le intestazioni.

$ cat headerlesscert.txt
MIICsDCCAhmgAwIBAgIJAMqzfnyqYsh+MA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQwHhcNMTQwNTEyMTMxODQ2WhcNMjQwNTA5MTMxODQ2WjBF
MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
gQDCYRMCJU7mW1Dy3Tkkmya3uARqFKZGcIgMgTi9M78Uyh1WOB+rBvhvCGSk1gcw
g1Ws8OL2fzWtvxLx4hb4+kyIXi8hQR+T1DeWdGxKKQ26zyA7678Ko5SoS06KvYK8
CNU5IXb9NGMHHWg8ilQoYyHZSZmROXOQPOGx0HR/wGrCeQIDAQABo4GnMIGkMB0G
A1UdDgQWBBQL826oByHeQ2eKfSW++K9yY3J51zB1BgNVHSMEbjBsgBQL826oByHe
Q2eKfSW++K9yY3J516FJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUt
U3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMqzfnyq
Ysh+MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAK0tQ6nEBxpVUWH+Q
/uz6CGggMVCe9ZiHw+OfEEazYXSimxFiy9DYpI2D4xuEBoEfLPugfzzVF94FNccV
5mm0yrncUA7D6vwoC9XYjX1SfhxR44jJml43Uj49osYNFoSGcSFkspI6/7TujPsP
qtxmmkWXATVV6kR4z9BwXEAnpr0=

$ echo '-----BEGIN CERTIFICATE-----' > cert.pem
$ cat headerlesscert.txt >> cert.pem
$ echo '-----END CERTIFICATE-----' >> cert.pem

$ openssl x509 -noout -text -in cert.pem
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            ca:b3:7e:7c:aa:62:c8:7e
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
        Validity
            Not Before: May 12 13:18:46 2014 GMT
            Not After : May  9 13:18:46 2024 GMT
        Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (1024 bit)
                Modulus:
                    00:c2:61:13:02:25:4e:e6:5b:50:f2:dd:39:24:9b:
                    26:b7:b8:04:6a:14:a6:46:70:88:0c:81:38:bd:33:
                    bf:14:ca:1d:56:38:1f:ab:06:f8:6f:08:64:a4:d6:
                    07:30:83:55:ac:f0:e2:f6:7f:35:ad:bf:12:f1:e2:
                    16:f8:fa:4c:88:5e:2f:21:41:1f:93:d4:37:96:74:
                    6c:4a:29:0d:ba:cf:20:3b:eb:bf:0a:a3:94:a8:4b:
                    4e:8a:bd:82:bc:08:d5:39:21:76:fd:34:63:07:1d:
                    68:3c:8a:54:28:63:21:d9:49:99:91:39:73:90:3c:
                    e1:b1:d0:74:7f:c0:6a:c2:79
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier:
                0B:F3:6E:A8:07:21:DE:43:67:8A:7D:25:BE:F8:AF:72:63:72:79:D7
            X509v3 Authority Key Identifier:
                keyid:0B:F3:6E:A8:07:21:DE:43:67:8A:7D:25:BE:F8:AF:72:63:72:79:D7
                DirName:/C=AU/ST=Some-State/O=Internet Widgits Pty Ltd
                serial:CA:B3:7E:7C:AA:62:C8:7E

            X509v3 Basic Constraints:
                CA:TRUE
    Signature Algorithm: sha1WithRSAEncryption
         2b:4b:50:ea:71:01:c6:95:54:58:7f:90:fe:ec:fa:08:68:20:
         31:50:9e:f5:98:87:c3:e3:9f:10:46:b3:61:74:a2:9b:11:62:
         cb:d0:d8:a4:8d:83:e3:1b:84:06:81:1f:2c:fb:a0:7f:3c:d5:
         17:de:05:35:c7:15:e6:69:b4:ca:b9:dc:50:0e:c3:ea:fc:28:
         0b:d5:d8:8d:7d:52:7e:1c:51:e3:88:c9:9a:5e:37:52:3e:3d:
         a2:c6:0d:16:84:86:71:21:64:b2:92:3a:ff:b4:ee:8c:fb:0f:
         aa:dc:66:9a:45:97:01:35:55:ea:44:78:cf:d0:70:5c:40:27:
         a6:bd

E l'altro file sembra essere una versione senza header del pubkey. Ottieni la versione meravigliosa se esegui il certificato tramite OpenSSL usando il parametro "-pubkey".

$ openssl x509 -noout -in cert.pem -pubkey
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCYRMCJU7mW1Dy3Tkkmya3uARq
FKZGcIgMgTi9M78Uyh1WOB+rBvhvCGSk1gcwg1Ws8OL2fzWtvxLx4hb4+kyIXi8h
QR+T1DeWdGxKKQ26zyA7678Ko5SoS06KvYK8CNU5IXb9NGMHHWg8ilQoYyHZSZmR
OXOQPOGx0HR/wGrCeQIDAQAB
-----END PUBLIC KEY-----
    
risposta data 24.02.2015 - 10:22
fonte

Leggi altre domande sui tag