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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:03:41+00:00 2026-06-02T08:03:41+00:00

I have a server which has its own cert and a client who is

  • 0

I have a server which has its own cert and a client who is trying to have the server generate a new cert for him (and sign it ofc). The client has given the server his public key and the server is supposed to create a cert and sign it. In PHP, how do I have the server create the cert with only the clients public key? openssl_csr_new seems to want the private key.

Thanks!

  • 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-02T08:03:42+00:00Added an answer on June 2, 2026 at 8:03 am

    you can do this with the latest SVN of phpseclib, a pure PHP X.509 parser. eg.

    <?php
    include('File/X509.php');
    include('Crypt/RSA.php');
    
    $privKey = new Crypt_RSA();
    $privKey->loadKey('-----BEGIN RSA PRIVATE KEY-----
    ...
    -----END RSA PRIVATE KEY-----');
    
    $pubKey = new Crypt_RSA();
    $pubKey->loadKey('-----BEGIN PUBLIC KEY-----
    ...
    -----END PUBLIC KEY-----');
    $pubKey->setPublicKey();
    
    $subject = new File_X509();
    $subject->setPublicKey($pubKey);
    $subject->setDNProp('id-at-organizationName', 'whatever');
    
    $issuer = new File_X509();
    // load the DN from an existing X.509 cert
    $issuer->loadX509('-----BEGIN CERTIFICATE-----
    ...
    -----END CERTIFICATE-----');
    $issuer->setPrivateKey($privKey);
    
    $x509 = new File_X509();
    $x509->setStartDate('-1 month');
    $x509->setEndDate('+1 year');
    $x509->setSerialNumber(1);
    
    $result = $x509->sign($issuer, $subject);
    echo $x509->saveX509($result);
    

    You’ll need your private key and the subjects public key. In this example, I’m getting the issuing DN from a X.509 previously signed by with your private key but you might want to call setDN() instead?

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

Sidebar

Related Questions

Hi I have a server which has several virtual hosts set up on it.
We have a reporting server which has a bunch of reports and some ad
I have a SQL Server database which has grown to more than 15GB in
I have an SQL reporting server report which has 5 parameters which permit nullable
I have a table in SQL Server 2005 which has three columns: id (int),
I have a table in SQL Server 2005 which has a date time field.
I have a windows 2003 server (WEb edition) which has .net 3.5 sp1 installed
We have a weblogic server 10.0 instance which has a cluster with one managed
I have an SQL Server 2005 table that has a varchar(250) field which contains
I have code which performs query on Jboss server. It has JNDI based datasource

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.