# Openssl

## 安装

```
yum install openssl -y
```

## 查看证书

查看证书内容

```
openssl x509 -in {{ 证书路径 }} -noout -text
```

查看证书序列号

```
openssl x509 -in {{ 证书路径 }} -noout -serial
```

查看证书拥有者

```
openssl x509 -in {{ 证书路径 }} -noout -subject
```

## 生成证书

例子：生成单向加密证书

```
# 生成私钥
openssl genrsa -out server.key 1024
# 生成证书
openssl req -new -x509 -days 3650 -key server.key -out server.crt -subj "/C=CN/ST=yourprovince/L=yourcity/O=yourorg/CN=yourdomain"
```

{% embed url="<https://blog.csdn.net/u013958257/article/details/107326771>" %}

## 参考资料


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viva.gitbook.io/project/sui-bi/linux/tls-jia-mi/openssl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
