vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
688 stars 175 forks source link

How should I move to production with real certificate? #127

Closed wellbranding closed 2 years ago

wellbranding commented 3 years ago

Hello, I am unsure how should I move to production (I am creating my own e-signing SAAS, which uses this code to create digital signatures). Specifically, I am not sure, about certificates using in this library. Should I somehow create my own certificate and bind it to public authority? Or how does that work? I suppose I can't use the following certificate /../resources/certificate.p12` to sign documents? Or can I?

danielbom commented 3 years ago

I'm using this library and I'm need this certificate too. I create a bash script to help me undestand what I need to make the .p12 certificate. This helps me and can help someone too, then I will put it here. This was my solution. Take and modify what you want.

# References:
# https://stackoverflow.com/questions/21141215/creating-a-p12-file
# https://www.digicert.com/kb/ssl-support/openssl-quick-reference-guide.htm#:~:text=The%20CSR%20is%20created%20using,you%20(or%20your%20company).

PASSWORD="XXXXX"
SLEEP_TIME=4

echo ""
echo "Generate 2048-bit RSA private key:"
echo ""

openssl genrsa -out private-key.pem 2048
sleep $SLEEP_TIME

echo ""
echo "Generate a Certificate Signing Request:"
echo ""

openssl req -new -sha256 -key private-key.pem -out certificate.csr
sleep $SLEEP_TIME

echo ""
echo "Generate a self-signed x509 certificate suitable for use on web servers:"
echo ""

openssl req -x509 -sha256 \
    -days 365 \
    -key private-key.pem \
    -in certificate.csr \
    -out certificate.pem
sleep $SLEEP_TIME

echo ""
echo "Create SSL identity file in PKCS12:"
echo ""

openssl pkcs12 -export \
    -out client-identity.p12 \
    -inkey private-key.pem \
    -in certificate.pem \
    -passout "pass:$PASSWORD"
sleep $SLEEP_TIME

echo ""
echo "Complete"
echo ""
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions.