Can openssl convert SSH public key to a PEM file without private key?












0















So I've seen many many posts on how to do the conversion with private key; but does anyone one know how I can do this with just only public key? As I'm trying to convert someone else's public key.



Or is this something not possible and I need to ask them to generate one themselves?










share|improve this question


















  • 1





    PEM format can wrap up a few different things. Could you clarify. Are you trying to create a certificate (x509) or are you just trying to convert the public key format?

    – Philip Couling
    Feb 11 at 10:43













  • are you trying to get a private key from a public key ? assymetric key were meant to make this impossible. Could you give more details ?

    – Archemar
    Feb 11 at 10:45











  • @PhilipCouling Sorry, I should've added what I was trying to do. It is for encrypting files to share.

    – Praveen P
    Feb 11 at 10:59
















0















So I've seen many many posts on how to do the conversion with private key; but does anyone one know how I can do this with just only public key? As I'm trying to convert someone else's public key.



Or is this something not possible and I need to ask them to generate one themselves?










share|improve this question


















  • 1





    PEM format can wrap up a few different things. Could you clarify. Are you trying to create a certificate (x509) or are you just trying to convert the public key format?

    – Philip Couling
    Feb 11 at 10:43













  • are you trying to get a private key from a public key ? assymetric key were meant to make this impossible. Could you give more details ?

    – Archemar
    Feb 11 at 10:45











  • @PhilipCouling Sorry, I should've added what I was trying to do. It is for encrypting files to share.

    – Praveen P
    Feb 11 at 10:59














0












0








0








So I've seen many many posts on how to do the conversion with private key; but does anyone one know how I can do this with just only public key? As I'm trying to convert someone else's public key.



Or is this something not possible and I need to ask them to generate one themselves?










share|improve this question














So I've seen many many posts on how to do the conversion with private key; but does anyone one know how I can do this with just only public key? As I'm trying to convert someone else's public key.



Or is this something not possible and I need to ask them to generate one themselves?







ssh osx encryption openssl






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 11 at 10:27









Praveen PPraveen P

1032




1032








  • 1





    PEM format can wrap up a few different things. Could you clarify. Are you trying to create a certificate (x509) or are you just trying to convert the public key format?

    – Philip Couling
    Feb 11 at 10:43













  • are you trying to get a private key from a public key ? assymetric key were meant to make this impossible. Could you give more details ?

    – Archemar
    Feb 11 at 10:45











  • @PhilipCouling Sorry, I should've added what I was trying to do. It is for encrypting files to share.

    – Praveen P
    Feb 11 at 10:59














  • 1





    PEM format can wrap up a few different things. Could you clarify. Are you trying to create a certificate (x509) or are you just trying to convert the public key format?

    – Philip Couling
    Feb 11 at 10:43













  • are you trying to get a private key from a public key ? assymetric key were meant to make this impossible. Could you give more details ?

    – Archemar
    Feb 11 at 10:45











  • @PhilipCouling Sorry, I should've added what I was trying to do. It is for encrypting files to share.

    – Praveen P
    Feb 11 at 10:59








1




1





PEM format can wrap up a few different things. Could you clarify. Are you trying to create a certificate (x509) or are you just trying to convert the public key format?

– Philip Couling
Feb 11 at 10:43







PEM format can wrap up a few different things. Could you clarify. Are you trying to create a certificate (x509) or are you just trying to convert the public key format?

– Philip Couling
Feb 11 at 10:43















are you trying to get a private key from a public key ? assymetric key were meant to make this impossible. Could you give more details ?

– Archemar
Feb 11 at 10:45





are you trying to get a private key from a public key ? assymetric key were meant to make this impossible. Could you give more details ?

– Archemar
Feb 11 at 10:45













@PhilipCouling Sorry, I should've added what I was trying to do. It is for encrypting files to share.

– Praveen P
Feb 11 at 10:59





@PhilipCouling Sorry, I should've added what I was trying to do. It is for encrypting files to share.

– Praveen P
Feb 11 at 10:59










1 Answer
1






active

oldest

votes


















1














If you are just looking to convert a public key, not create a certificate then you only need the public key.



ssh-keygen -f id_rsa.pub -e -m pem > id_rsa.pub.pem


Will read a public key file id_rsa.pub (containing just your friend's public key) and convert it to pem format.



The private key would be needed for something like a self signed certificate (in x509 format) because it's the private key that generates the signature.






share|improve this answer
























  • Thank you; this is what I was looking for.

    – Praveen P
    Feb 11 at 11:02











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f499906%2fcan-openssl-convert-ssh-public-key-to-a-pem-file-without-private-key%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














If you are just looking to convert a public key, not create a certificate then you only need the public key.



ssh-keygen -f id_rsa.pub -e -m pem > id_rsa.pub.pem


Will read a public key file id_rsa.pub (containing just your friend's public key) and convert it to pem format.



The private key would be needed for something like a self signed certificate (in x509 format) because it's the private key that generates the signature.






share|improve this answer
























  • Thank you; this is what I was looking for.

    – Praveen P
    Feb 11 at 11:02
















1














If you are just looking to convert a public key, not create a certificate then you only need the public key.



ssh-keygen -f id_rsa.pub -e -m pem > id_rsa.pub.pem


Will read a public key file id_rsa.pub (containing just your friend's public key) and convert it to pem format.



The private key would be needed for something like a self signed certificate (in x509 format) because it's the private key that generates the signature.






share|improve this answer
























  • Thank you; this is what I was looking for.

    – Praveen P
    Feb 11 at 11:02














1












1








1







If you are just looking to convert a public key, not create a certificate then you only need the public key.



ssh-keygen -f id_rsa.pub -e -m pem > id_rsa.pub.pem


Will read a public key file id_rsa.pub (containing just your friend's public key) and convert it to pem format.



The private key would be needed for something like a self signed certificate (in x509 format) because it's the private key that generates the signature.






share|improve this answer













If you are just looking to convert a public key, not create a certificate then you only need the public key.



ssh-keygen -f id_rsa.pub -e -m pem > id_rsa.pub.pem


Will read a public key file id_rsa.pub (containing just your friend's public key) and convert it to pem format.



The private key would be needed for something like a self signed certificate (in x509 format) because it's the private key that generates the signature.







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 11 at 10:55









Philip CoulingPhilip Couling

1,211917




1,211917













  • Thank you; this is what I was looking for.

    – Praveen P
    Feb 11 at 11:02



















  • Thank you; this is what I was looking for.

    – Praveen P
    Feb 11 at 11:02

















Thank you; this is what I was looking for.

– Praveen P
Feb 11 at 11:02





Thank you; this is what I was looking for.

– Praveen P
Feb 11 at 11:02


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f499906%2fcan-openssl-convert-ssh-public-key-to-a-pem-file-without-private-key%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?