首页 > 其他分享 >OpenSSL - Certificate Generation

OpenSSL - Certificate Generation

时间:2023-11-19 15:33:43浏览次数:39  
标签:Certificate certificate Generation self OpenSSL private signed key generate

We will use the OpenSSL (https://www.openssl.org/source/) tool to generate self-signed certificates. A certificate authority (CA) is responsible for storing, signing, and issuing digital certificates. This means we will first generate a private key and a self-signed certificate for the certificate authority:


The -subj parameter contains identity information about the certificate:
 /C is used for country.
 /ST is the state information.
 /L states city information.
 /O means organization.
 /OU is for the organization unit to explain which department.
 /CN is used for the domain name, the short version of common name.
 /emailAddress is used for an email address to contact the certificate owner.

You can verify the generated self-certificate for the CA with the following command:

openssl x509 -in ca-cert.pem -noout -text

Once you verify it, we can proceed with the private key and certificate signing request:

Then we will use CA’s private key to sign the request:

An example configuration for ext file option is as follows:

subjectAltName=DNS:*.microservices.dev,DNS:*.microservices.dev,IP:0.0.0.0

Now you can verify the server’s self-signed certificate:

openssl x509 -in server-cert.pem -noout -text

For mTLS communication, we need to generate a certificate signing request for the client side, so let’s generate a private key and this self-signed certificate:

Now, let’s sign it using the CA’s private key:

Finally, you can verify the client certificate with the following command:

openssl x509 -in client-cert.pem -noout -text

 

标签:Certificate,certificate,Generation,self,OpenSSL,private,signed,key,generate
From: https://www.cnblogs.com/zhangzhihui/p/17842120.html

相关文章

  • openssl创建证书
    安装brewinstallopenssl使用root@MACdeMBPrem_key#opensslreq-x509-newkeyrsa:4096-keyoutkey.pem-outcert.pem-days365Generatinga4096bitRSAprivatekey....................................................................................................
  • 执行git clone命令报错 ssl certificate problem:unable to get local issue certific
    1、背景说明 使用gitclone命令,拉取远程的https的git仓库时,报错:unabletoaccess"https://xxxx.com/n_patch_test.git/":sslcertificateproblem:unabletogetlocalissuecertificate 2、问题分析及解决 2.1分析通过上面的报错信息,可以分析到,是git的证书的问......
  • OpenSSL学习(Secure Socket Layer)2023/11/13
    示例OpenSSL版本为OpenSSL3.0.215Mar2022(Library:OpenSSL3.0.215Mar2022)别搞错了!搞错容易在sm2签名验签出问题生成自签名证书opensslreq-x509-newkeyrsa:2048-keyoutmykey.pem-outmycert.pem-days365req:表示进行证书请求和生成。-x509:表示生成自......
  • CentOS7编译安装openssl1.1.1
    Centos7默认提供的openssl版本是1.0.2的,想要升级openssl版本则需要手动进行编译一、下载openssl1.1.1cd/usr/local/src/wget--no-check-certificatehttps://www.openssl.org/source/openssl-1.1.1d.tar.gz二、创建安装目录mkdir-p/usr/local/openssl 三、解压......
  • kubeadm部署的k8s证书过期问题 k8s问题排查:the existing bootstrap client certifica
     解决问题:估计跟移动有关,下面那个没解决问题,是因为在原有文件的基础上修改的吧?而这里直接是移走,重新生成了新的。不太清楚是不是这个原因。$cd/etc/kubernetes/pki/$mv{apiserver.crt,apiserver-etcd-client.key,apiserver-kubelet-client.crt,front-proxy-ca.crt,front......
  • Node opensslErrorStack 错误解决方法记录
    从Git仓库中下载了一个老项目,使用npminstall安装后没有问题,当我使用npmrundev的时候遇到了OpenSSL相关错误,例如opensslErrorStack:['error:03000086:digitalenveloperoutines::initializationerror']网上找了一下相关信息,然后顺利解决了,记录分享给大家问题原因:这种错......
  • openssl 加密
    对称加密算法查询,显示当前环境下所有支持的算法列表。print_r(openssl_get_cipher_methods());php8.1.11的加密算法[0]=>aes-128-cbc[1]=>aes-128-cbc-hmac-sha1[2]=>aes-128-cbc-hmac-sha256[3]=>aes-128-ccm[4]=>aes-128-cfb[5]=>a......
  • ERROR: dependencies ‘openssl’, ‘curl’ are not available for package ‘creden
     001、问题:R语言安装“devtools” ERROR:dependencies‘openssl’,‘curl’arenotavailableforpackage‘credentials’ 002、解决方法: ......
  • Base64编码、解码 C语言例子(使用OpenSSL库)
    #include<stdio.h>#include<string.h>#include<unistd.h>#include<openssl/pem.h>#include<openssl/bio.h>#include<openssl/evp.h>intbase64_encode(char*in_str,intin_len,char*out_str){BIO*b64,*bio;......
  • 20.8 OpenSSL 套接字SSL传输文件
    有了上面的基础那么传输文件的实现就变得简单了,在传输时通常我们需要打开文件,并每次读入1024个字节的数据包,通过SSL加密传输即可,此处的文件传输功能在原生套接字章节中也进行过详细讲解,此处我们还是使用原来的密钥对,实现一个服务端等待客户端上传,当客户端连接到服务端后则开始传输......