How to get the key ID from a .pem openssl file?
I have a .pem private key generated by openssl. How to extract the key ID from it?
Edit: the generated rsa keypair is for Amazon cloudfront. When uploaded on the console, a 'Key ID' is displayed. However the private key I have generated is not for my account and I don't have any slot available to upload the public key on my AWS account (there's a limit of 2 public keys).
Bare keys do not have "key IDs". They're just series of numbers.
If the key belongs to an X.509 certificate, then the certificate's fingerprint (a SHA-1 hash of the DER-encoded cert) will be used for identification: openssl x509 -outform der | openssl sha1, or openssl x509 -noout -fingerprint.
Otherwise (if it's just a bare public/private keypair), the SHA-1 hash of the public key is used sometimes (again, DER encoding), but I don't know of any standard for it. You can extract the public key with openssl rsar -pubout -outform der, again piping to openssl sha1 if that's what your program requires.
Comments
Post a Comment