小编Rod*_*igo的帖子

使用 bash 将十六进制值写入二进制文件

如何自动在二进制文件中写入特定数量的零?

我写的:

#!/bin/bash
for i in {0..127};
do
    echo -e -n "\x00" >> file.bin
done
Run Code Online (Sandbox Code Playgroud)

但是查看带有 Bless 输出的文件:2D 65 20 2D 6E 20 5C 78 30 30 0A对应于-e -n \x00.

bash binary

4
推荐指数
2
解决办法
1万
查看次数

使用 openssl 中创建的证书颁发机构签署证书请求

我使用以下命令在 Ubuntu 中创建了一个证书颁发机构:

openssl req -config /etc/ssl/openssl.cnf -new -x509 -keyout ck.pem -out cacert.pem -days 365
Run Code Online (Sandbox Code Playgroud)

然后我使用以下命令创建了一个证书请求:

openssl req -out C.csr -new -newkey rsa:2048 -nodes -keyout c_p.key
Run Code Online (Sandbox Code Playgroud)

我想使用我创建的证书颁发机构签署此请求。为此我执行了:

openssl ca -config /etc/ssl/openssl.cnf -policy optional -out C.crt -infiles C.csr
Run Code Online (Sandbox Code Playgroud)

但我收到错误:

Using configuration from /etc/ssl/openssl.cnf unable to load CA
private key 140189274035872:error:0906D06C:PEM
routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: ANY
PRIVATE KEY
Run Code Online (Sandbox Code Playgroud)

我怎样才能摆脱这个错误?该命令会使用我上面定义的权限还是系统中的某些默认权限?

编辑:

为了完整起见,我留下了必须执行的步骤:

  1. 创建相关文件:
mkdir demoCA
mkdir ./demoCA/newcerts
touch ./demoCA/index.txt
Run Code Online (Sandbox Code Playgroud)

还要在 demoCA 中创建一个“串行”文件,其中包含 01 和末尾的换行符。

  1. 证明:
openssl ca -config /etc/ssl/openssl.cnf -cert cacert.pem -keyfile ck.pem -out …
Run Code Online (Sandbox Code Playgroud)

openssl certificates

3
推荐指数
1
解决办法
6930
查看次数

标签 统计

bash ×1

binary ×1

certificates ×1

openssl ×1