Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3438914
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:14:43+00:00 2026-05-18T08:14:43+00:00

First – what happens if I don’t give a passphrase? Is some sort of

  • 0

First – what happens if I don’t give a passphrase? Is some sort of pseudo random phrase used? I’m just looking for something "good enough" to keep casual hackers at bay.

Second – how do I generate a key pair from the command line, supplying the passphrase on the command line?


I finally got it working using these commands, using exec() which it is generally reckoned not safe to use, being better to give the PassPhrase in a file. I can accept this risk as I am sure that the PHP will only ever be executed on my PC (which runs windows & doesn’t have a PS command).

openssl genrsa -aes128 -passout pass:foobar -out privkey.pem 2048
openssl rsa -in privkey.pem -passin pass:foobar -pubout -out privkey.pub

Many many thanks to @caf, without whom this would not have been possible.

Only one regret – that, no matter how much I Google, no one can seem to get openssl_pkey_new() working with Xampp on Windows (which is the proper way to generate a key pair)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:14:44+00:00Added an answer on May 18, 2026 at 8:14 am

    If you don’t use a passphrase, then the private key is not encrypted with any symmetric cipher – it is output completely unprotected.

    You can generate a keypair, supplying the password on the command-line using an invocation like (in this case, the password is foobar):

    openssl genrsa -aes128 -passout pass:foobar 3072
    

    However, note that this passphrase could be grabbed by any other process running on the machine at the time, since command-line arguments are generally visible to all processes.

    A better alternative is to write the passphrase into a temporary file that is protected with file permissions, and specify that:

    openssl genrsa -aes128 -passout file:passphrase.txt 3072
    

    Or supply the passphrase on standard input:

    openssl genrsa -aes128 -passout stdin 3072
    

    You can also used a named pipe with the file: option, or a file descriptor.


    To then obtain the matching public key, you need to use openssl rsa, supplying the same passphrase with the -passin parameter as was used to encrypt the private key:

    openssl rsa -passin file:passphrase.txt -pubout
    

    (This expects the encrypted private key on standard input – you can instead read it from a file using -in <file>).


    Example of creating a 3072-bit private and public key pair in files, with the private key pair encrypted with password foobar:

    openssl genrsa -aes128 -passout pass:foobar -out privkey.pem 3072
    openssl rsa -in privkey.pem -passin pass:foobar -pubout -out privkey.pub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First some background: I'm working on an application and I'm trying to follow MVVM
first I used onDestroy() method as below to make something when my app is
first question asked, so I'll get straight to it. I've got some C code
First of all, some background: I'm trying to get in a list of integers
First let me phrase the proper question: Q: There is a file containing more
First of all, I just installed XE2 for the first time, and plan to
first some code: I have many elements like that: <section class=item> <div class=caption> </div>
First off...here's the problem... Give an example of a directed graph G = (V,
First off, I'm working on an app that's written such that some of your
First of all, I don't need a textual comparison so Beyond Compare doesn't do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.