生成OpenSSL私钥和公钥 [英] Generate OpenSSL private and public keys

查看:111
本文介绍了生成OpenSSL私钥和公钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个任务:为银行生成私钥/公钥对.

I have a task: generate private/public key pairs for banks.

应该包括用户数据,例如州,城市,公司,名称,电子邮件以及其他一些数据.如何使用PHP或Shell生成这些密钥?

User data like State, City, Company, Name, Email, and some other data should be included. How I can generate those keys with PHP or Shell?

更新1

我需要银行的私钥和证书.

I need a private key and cert for a Bank.

推荐答案

PHP提供了接口OpenSSL功能.您需要生成一个证书(密钥对不能包含用户数据),这比生成密钥对要复杂一些.您可以生成自签名证书(在此类证书中,颁发者"和主题"字段是相同的),可能正是您所需要的.

PHP offers interface to OpenSSL functions. You need to generate a certificate (the keypair can't include user data), and this is a bit more complicated than generating a keypair. You can generate self-signed certificates (in such certificates Issuer and Subject fields are identical), which is probably what you need.

如果您需要CA签名的证书,则需要生成证书签名请求(CSR)和私钥,然后将CSR发送到将对其进行签名并发回证书的证书颁发机构(请记住,私钥仍在您的身边,因此您需要保存它).

If you need a CA-signed certificate, than you need to generate a certificate signing request (CSR) and a private key, then send a CSR to the certificate authority that will sign it and send you back the certificate (remember that private key remains on your side, so you need to save it).

此外, google搜索显示了为您准备的好指南.

这篇关于生成OpenSSL私钥和公钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆