Re: Encrypt existing PEM keyfile

Robert Moskowitz <rgm-tZ9RT1K724GHT8/[email protected]>
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>
openssl pkey -in testprv.pem -aes128 -out testoprv.pem

And with the command line, you cannot overwrite the in file.  I tried.  :)

thanks

On 9/25/24 05:49, Robert Moskowitz wrote:
> ARGH!!!  :)
>
> Like I said, my search foo is weak.
>
> And I use "openssl pkey" often enough to display the PEM content.
>
> Sigh.    Thanks.
>
> On 9/25/24 00:16, David von Oheimb wrote:
>> Hi, looks like you missed 
>> https://docs.openssl.org/master/man1/openssl-pkey/
>>
>> David
>>
>> Sep 24, 2024 19:44:11 Robert Moskowitz <rgm-tZ9RT1K724GHT8/[email protected]>:
>>
>>     Right now I want to use openssl command line to be able to take
>>     as input an unecrypted PEM Keyfile (EdDSA) and output it password
>>     protected.
>>
>>     I have created the keyfile in python using:
>>
>>             f.write(private_key.private_bytes(
>>                 encoding=serialization.Encoding.PEM,
>>                 format=serialization.PrivateFormat.PKCS8,
>>     encryption_algorithm=serialization.NoEncryption(),
>>                 ))
>>
>>     I have found that to have written it encrypted, that should be
>>
>>     encryption_algorithm=serialization.BestAvailableEncryption(b'xyz'))
>>
>>     But I want to be able to work this out step by step, adding the
>>     encryption of the PEM keyfile.
>>
>>     Thus the desire to take an existing unprotected PEM and put out a
>>     password protected one that I can read in to another script.
>>
>>     Looked all over in the docs and asked Dr. Google, but my search
>>     foo is still weak and not finding this out.
>>
>>     Would someone point the way for me?  :)
>>
>>     Also is the "BestAvailableEncryption" the way to write it
>>     password protected in the first place?
>>
>>     Thanks!
>>
>>
>>     -- 
>>     You received this message because you are subscribed to the
>>     Google Groups "openssl-users" group.
>>     To unsubscribe from this group and stop receiving emails from it,
>>     send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
>>     To view this discussion on the web visit
>>     https://groups.google.com/a/openssl.org/d/msgid/openssl-users/9893dea9-dfcc-4525-a36a-af7d371bfde2%40htt-consult.com.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups "openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion on the web visit https://groups.google.com/a/openssl.org/d/msgid/openssl-users/dd1a0b4e-7be8-4825-b493-117a859d5c11%40htt-consult.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.