Using your code, a dummy CA and a dummy self-signed cert I cannot replicate your results. Please update your example or include the openssl version.
Last output line is error: mycert.pem: verification failed
and the return code is 2 (echo $?
) as opposed to the OK message with a 0 return code. I also get the error 18 self-signed message you received. I am using openssl 1.1.1i.
Error 18 is in fact, a robust error code and is documented in the openssl verify man page as the code specifically for self signed certificates.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…