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

  • SEARCH
  • Home
  • 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 378365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:47:10+00:00 2026-05-12T14:47:10+00:00

I am trying to make a fake CA and sign a certificate with it

  • 0

I am trying to make a fake CA and sign a certificate with it to use with stunnel (which just seems to be calling OpenSSL routines, so you probably don’t need to know the program to help :). However, stunnel keeps rejecting my certificate saying that it isn’t signed with the right key!

This is how I’m generating my keys and certs with OpenSSL:

openssl genrsa -out ca_key.pem 1024

openssl req -config ./root2.cfg -new -sha1 -x509 -key ca_key.pem -out ca_cert.pem -subj "/CN=blah.blah.com/OU=Dev blah CA/C=CA/ST=blah/L=blah/O=Blah Software"

openssl genrsa -out MPS_key.pem 1024

openssl req -config ./MPS2.cfg -new -sha1 -key MPS_key.pem -out MPS_cert_req.pem -subj "/CN=blah.blah.com/OU=blah Certificate/C=CA/ST=blah/L=blah/O=Blah Software"

openssl x509 -req -in MPS_cert_req.pem -signkey ca_key.pem -out MPS_cert.pem -extensions MPS_ext

Then my stunnel.conf has these entries:

CAfile = ca_cert.pem
key = MPS_key.pem
cert = MPS_cert.pem

When I try and start stunnel I get the generic OpenSSL “key doesn’t match certificate” error:

2009.09.09 16:36:04 LOG3[492:172]: SSL_CTX_use_RSAPrivateKey_file: B080074: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch

Did I do something wrong in generating my files?

  • 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-12T14:47:10+00:00Added an answer on May 12, 2026 at 2:47 pm

    I’ll summarize what you have setup:

    1. You have a “CA” certificate, which is self-signed.
    2. You have MPS_cert, which is self-signed.
    3. You signed MPS_cert using the CA key.

    If you read the reference for OpenSSL’s x509 command (http://openssl.org/docs/apps/x509.html) you’ll see that the -signkey parameter instructs OpenSSL to self-sign the supplied certificate with the given private key. This is not what you want.

    What you want to do is create a self-signed CA and then use that to sign your CSR and generate a valid certificate.

    openssl verify ca_cert.pem
    ca_cert.pem: /CN=blah.blah.com/OU=Dev blah CA/C=CA/ST=blah/L=blah/O=Blah Software
    error 18 at 0 depth lookup:self signed certificate
    OK
    
    openssl verify MPS_cert.pem
    MPS_cert.pem: /CN=blah.blah.com/OU=blah Certificate/C=CA/ST=blah/L=blah/O=Blah Software
    error 18 at 0 depth lookup:self signed certificate
    OK
    

    The relevant options are -CA, -CAkey, and -set_serial

    openssl x509 -CA ca_cert.pem -CAkey ca_key.pem -set_serial 1 -req -in MPS_cert_req.pem -out MPS_cert2.pem -days 365
    

    This should result in a certificate which is signed by your CA, which is itself self-signed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to iOS development and trying make a simple app which
I'm trying make a report which contains some prices on every row, and I
I'm trying to use the code from this article: Creating Fake Enums , but
I'm trying to make a fake opengl32.dll on Windows to capture OpenGL calls. When
Im trying to make this dynamic email input field which uses autocomplete on a
I'm trying to make DI with Guice work, doing (as it seems to me)
I have a little issue with Zend. I am trying to make some fake
I'm making up fake email addresses and I just want to make sure they
I'm trying to make a system which asks users to specify what kind of
I'm trying make a login window where a user is prompted to enter their

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.