openca / libpki

Easy-to-use high-level library for PKI-enabled applications
Other
50 stars 34 forks source link

pki-tool genreq fails with: REQ::ERROR signing the Request [error:00000000:lib(0):func(0):reason(0)] #17

Closed NHellFire closed 1 year ago

NHellFire commented 7 years ago

Attempting to generate a CSR results in:

# pki-tool genreq -config /opt/ocspd/etc/ocspd/pki -outkey /opt/ocspd/etc/ocspd/private/key.pem -newkey -bits 2048 -subject 'CN=OCSP Server, O=OpenCA, C=US' -algor RSA-SHA256 -out /opt/ocspd/etc/ocspd/req.pem -batch -debug
May 29 20:00:37 2017 GMT [1213] INFO: [token.c:2570] [DEBUG] ERROR, can not load directory /root/.libpki/profile.d!
May 29 20:00:37 2017 GMT [1213] INFO: [token.c:842] [DEBUG] Can not load profiles (/root/.libpki/profile.d)

May 29 20:00:37 2017 GMT [1213] INFO: [pki-tool.c:214] [DEBUG] Output URL: /opt/ocspd/etc/ocspd/private/key.pem
May 29 20:00:37 2017 GMT [1213] INFO: [pki_algor.c:108] [DEBUG] GETTING ALGORITHM: RSA-SHA256
May 29 20:00:37 2017 GMT [1213] INFO: [pki_algor.c:117] [DEBUG] GOT ALGORITHM ID: 668
May 29 20:00:39 2017 GMT [1213] INFO: [pki_algor.c:108] [DEBUG] GETTING ALGORITHM: RSA-SHA256
May 29 20:00:39 2017 GMT [1213] INFO: [pki_algor.c:117] [DEBUG] GOT ALGORITHM ID: 668
May 29 20:00:39 2017 GMT [1213] INFO: [pki_x509_req.c:48] [DEBUG] Digest Algorithm: SHA256
May 29 20:00:39 2017 GMT [1213] INFO: [pki_x509_name.c:123] [DEBUG] ADDING KEY (mrdn=0) -> CN
May 29 20:00:39 2017 GMT [1213] INFO: [pki_x509_name.c:123] [DEBUG] ADDING KEY (mrdn=0) -> O
May 29 20:00:39 2017 GMT [1213] INFO: [pki_x509_name.c:123] [DEBUG] ADDING KEY (mrdn=0) -> C
May 29 20:00:39 2017 GMT [1213] INFO: [pki_x509_req.c:207] [DEBUG] REQ::ERROR signing the Request [error:00000000:lib(0):func(0):reason(0)]
ERROR, can not generate a new Request!

libpki 0319d1e, built with ./configure --prefix=/opt/ocspd && make Ubuntu 17.04, OpenSSL v1.0.2g

opencrypto commented 1 year ago

The tool syntax has changed and uses the following syntax now:

pki-tool genreq -config /opt/ocspd/etc/ocspd/pki -outkey key.pem -newkey -param bits:2048 \
    -subject 'CN=OCSP Server, O=OpenCA, C=US' -algor RSA -out req.pem -batch -debug