openssl - openssl CLI 输出中 notAfter/enddate 的额外空间

标签 openssl

我在该命令的 enddate 输出中获得了额外的空间:

$ export IP=google.com;  nc -z -w 3 $IP 443 && (echo | openssl s_client -
connect $IP:443 2>/dev/null | openssl x509 -noout -enddate)
Connection to google.com port 443 [tcp/https] succeeded!
notAfter=Apr  4 09:40:00 2018 GMT

注意 notAfter= 行中 Apr 和 4 之间的两个空格。

我在笔记本电脑和 Linux 服务器上的两个版本都是这种情况:

$ openssl version
LibreSSL 2.2.7
$ openssl version
OpenSSL 1.0.1f 6 Jan 2014

这是错误吗?我会尝试在https://github.com/openssl/openssl/issues中举报

我们开始:

https://github.com/openssl/openssl/issues/5107

https://github.com/libressl-portable/portable/issues/382

最佳答案

This is intentional behavior from ASN1_TIME_print(), to use a fixed number of characters for the day representation. If the day number is less than 10, it still takes up two columns, with the first one being filled as a space. This is friendly to automated tooling parsers even if it is a little jarring for the human eye. I don't think it's appropriate to change ASN1_TIME_print()'s behavior because it is used in more places than just this.

来自https://github.com/kaduk

https://github.com/openssl/openssl/issues/5107#issuecomment-358746180

关于openssl - openssl CLI 输出中 notAfter/enddate 的额外空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48328163/

相关文章:

android-ndk - 使用Android NDK编译依赖于其他 native 库运行的 native 库?

openssl - 在 OpenSSL 命令行工具中为自定义扩展创建自己的 ASN.1 模块

c++ - 带 SSL 的简单 gSoap 服务器和客户端

linux - 使用 OpenSSL 哈希进行文件比较

openssl - 使用 OpenSSL 将 PKCS#12 证书转换为 PEM

C# RSA 公钥输出不正确

ssl - 如何将生成的 SSL 证书转换为 PKCS12

ruby - SSL_connect 返回=1 错误号=0 状态=错误 : certificate verify failed in ruby and Ubuntu 14. 04

ssh - 使用 OpenSSL 生成私钥,为 SSH 生成公钥 ssh-keygen

php - 带有 PHP 5.6 和 Composer 的 OpenSSL - 证书验证失败