Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

it must be 2 am in the morning... and ive had zero sleep. Nonetheless... I am trying to get my developer to send me a public ssh key. If the guy sends you a file that begins with:

-----BEGIN CERTIFICATE-----
MIIGgzCCBGugAwIBAgIJAOm7SVMTNGm5MA0GCSqGSIb3DQEBBQUAMIGHMQswCQYD
VQQGEwJJTjELMAkGA1UECBMCVVAxDjAMBgNVBAcTBU5vaWRhMREwDwYDVQQKEwhU
ZWttaW5kejEUMBIGA1UECxMLRW5naW5lZXJpbmcxDDAKBgNVBAMTA2RyZzEkMCIG
CSqGSIb3DQEJARYVcm9iLnNwYWRlQHNhc2FpbmMubmV0MB4XDTEyMTAyMzA2MDUw
NloXDTIzMDEyOTA2MDUwNlowgYcxCzAJBgNVBAYTAklOMQswCQYDVQQIEwJVUDEO
MAwGA1UEBxMFTm9pZGExETAPBgNVBAoTCFRla21pbmR6MRQwEgYDVQQLEwtFbmdp
bmVlcmluZzEMMAoGA1UEAxMDZHJnMSQwIgYJKoZIhvcNAQkBFhVyb2Iuc3BhZGVA
-----END CERTIFICATE-----

Is a pem cert, correct, not a public key? :) Should i email back to say recreate?
Thanks! )

share|improve this question
    
was expecting something along the lines of : cat .ssh/id_dsa.pub ssh-dss AAAAB3NzaC1kc3MAAACBAKVifmgpyGYg8OteHL2d1uzlW4CU3CJxVW91aNl70aeMfTW/7cMCi+1ZYsTi‌​gaKClchVN3fcOPNyo4EGQ0Elq40JolgxFvuHBmfOlJZGBrSrzm2DCpnd2JvEkgXjHGayCCpVRfKDuB+Ax‌​a30ct2VmZbBeZd3hW25yhlz1HDqjQ3xAAAAFQDLYUqSv1nSxEw9EqQn9G++FD6VxwAAAIEAkjFxCj9+ra‌​6movzxu/+h2HYkFsbO/4dOWS/HJ2z64y9ZDtPy2td+/88A46QqKI+rGZGH6OPn58X2wPGmhwyuMKPV0I5‌​ymBxWcPjI= member@rampage –  CMag Oct 23 '12 at 6:21
    
is this a typo on the dev side? :)hehe –  CMag Oct 23 '12 at 6:21
1  
Clustermagnet, you might want to go back and review your existing stock of questions; there are quite a lot of them with valid answers, none of which have been aceepted. 67%'s not a terrible accept rate, but if you could improve it, that'd be much appreciated. –  MadHatter Oct 23 '12 at 6:35

1 Answer 1

up vote 2 down vote accepted

That is an x509 certificate. Since a certificate contains a public key, and an SSH key is just a public key, it is possible to convert that into the OpenSSH key format. It's fairly uncommon to distribute keys like that however, so the developer may have sent you the wrong thing. To try to convert it use something like the following though:

% head -n2 test.crt
-----BEGIN CERTIFICATE-----
MIICWDCCAcGgAwIBAgIJAKyY2+5477dGMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
% openssl x509 -in test.crt -pubkey -noout > test.pub
% ssh-keygen -i -m PKCS8 -f test.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCtpZDQLOzXwlhLWvjquDzfE0hwtUjD1jQCfv5pcuPGfI918d+nKufDbnjCB1mmg2PTZb+PcVv2zeqnvBEISJh6idnOoQSZgx/gkS1VEkOJtaG+ECMUwW4/hiUbGlVkKaIhuy9eyoLdF/pJRE5ZNGNxSxwT/3111gxcZqc8VF1n6w==

Edit: It looks like the import feature from PKCS8 was added somewhere between 5.5p1 and 5.8p1, if your ssh-keygen doesn't have the -m option you'll need to find a later version.

share|improve this answer
    
thanks! illegal option -m though... –  CMag Oct 23 '12 at 6:29
    
@Clustermagnet I think you'll need to find a more recent version of ssh-keygen (details in answer). –  mgorven Oct 23 '12 at 6:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.