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 8044207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:09:17+00:00 2026-06-05T05:09:17+00:00

I am newbie in openSSL library and PKI . I have simple question for

  • 0

I am newbie in openSSL library and PKI .
I have simple question for openSSL experts.

Does anybody know how to create certificates for code samples in this article
“An Introduction to OpenSSL programming (Part I/II)” by Eric Rescorla

http://www.rtfm.com/openssl-examples/part1.pdf

http://www.rtfm.com/openssl-examples/part2.pdf

I have downloaded source code from http://www.rtfm.com/openssl-examples
The problem is that certificates are expired and I don’t know how to create new root certificate.

How to create root certificate? How to create certificates for client and server app? Wich ciphering algorithm should I use?
As far as i understand i shuld do the following:

  • Create key pair. Secret and public keys.
  • Create certificate request (p10 format).
  • Create selfsigned root sertificate (x509 format).

Details is not clear from the article.

This is how I am trying to create certificates:

1) Creating CA private key and certificate request:
openssl req -newkey rsa -keyout ./ca_key.pem out.pem -out ./ca_req.pem -days 1095 -passin pass:”password” -subj “some information about CA” -extensions v3_ca

2) Create self signed CA certificate
openssl ca -create_serial -in ca_req.pem -out root.pem -days 1095 -passin pass:”password” -selfsign -extension v3_ca

3)generate server private key and request for certificate
openssl req -newkey rsa -keyout server_key.pem out server_req.pem -days 1095 -passin pass:”password” -subj “some information about server”

4)create server certifiate (this certificate is not self signed. This certificate signed by CA private key)
openssl ca -in server_req.pem -out server.pem -passin pass:”password”

5)generate user private key and request for certificate
openssl req -newkey rsa -keyout user_key.pem out user_req.pem -days 1095 -passin pass:”password” -subj “some information about client”

6)create user certifiate (this certificate is not self signed. This certificate signed by CA private key)
openssl ca -in user_req.pem -out client.pem -passin pass:”password”

I am not sure about “rsa” algorithm here. May be I shuold use other algorthm.

So i have root.pem, server.pem, client.pem
I put client key and certificate to client.pem
And the same thing for server.pem. ( The same way as in the articles sample certificates.)

But when i try to start server with these new generated certificates i have an error:
“Couldn’t open DH file.”

When I put old DH file to current folder and server starts.
(dh1024.pem What is it?)

The next step. I start client and I got another error message: “Cetrificate doesn’t verify.”

The error code is 20. Desciption for code 20 in x509_vfy.h is “unable to get issuer certificate locally”

All of this means that I have created certificates incorrectly.
I don’t know how to do it correctly.

Does anybody have an idea?

  • 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-06-05T05:09:19+00:00Added an answer on June 5, 2026 at 5:09 am

    This is the solution.
    May be it is not optimal but it works. The only difference with question solution is option: “-des3 1024”

    #!/bin/sh
    
    alg="rsa"
    
    ossl="openssl"
    
    passwd="password"
    
    #certificate autority folder
    caFolder="./demoCA"
    
    #delete old certificates, CA folder and keys 
    rm -rf *.pem
    
    rm -rf $caFolder
    
    #create folder structure
    mkdir $caFolder
    mkdir "$caFolder/private"
    mkdir "$caFolder/newcerts"
    
    #generate RSA private key for CA
    $ossl genrsa -out ca_key.pem 1024
    
    #Creating certificate request:
    $ossl req -new -key ca_key.pem -out ./ca_req.pem -days 1095 -passin pass:$passwd  -passout pass:$passwd \
    -subj /C=RU/ST=Moscow/L=Moscow/O=company/OU=TestCAs/CN=TestCA/emailAddress=TestCA@company.ru -extensions v3_ca
    
    cp ca_key.pem "$caFolder/private/cakey.pem" 
    
    touch "$caFolder/index.txt"
    
    #Create self signed CA certificate 
    $ossl ca -create_serial -in ca_req.pem -out ca_cert.pem -days 1095 -passin pass:$passwd -selfsign -extensions v3_ca -notext
    cp ca_cert.pem "$caFolder/cacert.pem"
    
    
    #generate SERVER private key and request for certificate 
    $ossl genrsa -out server_key.pem -passout pass:$passwd -des3 1024
    
    $ossl req -new -key server_key.pem  -passin pass:$passwd \
    -passout pass:$passwd -out server_req.pem -days 1095 \
    -subj /C=RU/ST=Moscow/L=Moscow/O=company/OU=SSLServers/CN=localhost/emailAddress=SSLServer@company.ru  
    
    #create SERVER certifiate (this certificate is not self signed. This certificate signed by CA private key)
    $ossl ca -in server_req.pem -out server_cert.pem -passin pass:$passwd -notext
    
    
    #generate RSA private key for client
    $ossl genrsa -out user_key.pem -passout pass:$passwd -des3 1024
    
    #generate request certificate for client
    $ossl req -new -key user_key.pem -out user_req.pem -days 1095 \
    -passin pass:$passwd -passout pass:$passwd \
    -subj /C=RU/ST=Moscow/L=Moscow/O=company/OU=Clients/CN=Client/emailAddress=Client@company.ru 
    
    #create user certifiate (this certificate is not self signed. This certificate signed by CA private key) 
    $ossl ca -in user_req.pem -out user_cert.pem -passin pass:$passwd -notext
    
    #generate  DH   param
    $ossl dhparam -out dh1024.pem 1024
    
    cat ./user_key.pem ./user_cert.pem > client.pem  
    
    cat ./server_key.pem  ./server_cert.pem  > server.pem
    
    cp ./ca_cert.pem root.pem
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie question... The objective: I intend to have an HTML text input field as
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Newbie backbone question: Context: Building a shopping list with backbone I have a model
newbie question in css: I have the following style defined: TABLE.tabulardata th { font:
Newbie question: some vendors propose solution like generating dynamic certificates to allow user who
Newbie question here but for some reason I cant figure this out. I have
Newbie question. I’m writing an ASP.Net MVC app in VB.Net and have been using
Newbie question i have following function: function isadult($description) { $bad=/*comma separated bad words*/; $bad=explode(,,$bad);
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Newbie question... So I have two activities, Cherry and Apple, and each one has

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.