I tried to use openssl to sign cert request with my own CA. There are two options.
openssl x509.openssl X509 -req -CA ca.crt -CAkey ca.pem -in bob.csr -out bob.crt -CAcreateserial`
Some posts say x509 is used to generate self-signed certificates.
But error occurs using openssl X509:
unable to load certificate 6612:error:0906D06C:PEM routines:PEM_read_bio:no start line:.\crypto\pem\pem_lib.c:701:Expecting: TRUSTED CERTIFICATE openssl ca:openssl ca -in bob.csr -out bob.crt -keyfile ca.key
It needs to config openssl.config beforehand. E.g., create dir ./demoCA.
Please let me know which way is correct. If openssl x509 is correct, how to solve expecting trusted certificate error? Very appreciate!
-CAfile hereca.crtcontains the CA cert; if the-CAfile is something other than a cert I get the error you do (and if it's a cert but the wrong cert I get0B080074 ... key values mismatch). Check that file.openssl cais a valid alternative which does need several things set in a config file, although that file can have any name you choose (with-config) and it doesn't have to use a specific subdirectory or even any subdirectory, that's just a convention.SSL_CTX_use_certificateand I solved it with merging two files into one: the one with-----BEGIN RSA PRIVATE KEY-----and the one with-----BEGIN CERTIFICATE-----