{"id":441,"date":"2013-02-28T13:45:31","date_gmt":"2013-02-28T12:45:31","guid":{"rendered":"http:\/\/songoku.homelinux.com\/wordpress\/?p=441"},"modified":"2026-08-13T10:13:42","modified_gmt":"2026-08-13T08:13:42","slug":"create-self-signed-certificates-with-openssl","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=441","title":{"rendered":"Create CA-\/self-signed certificates with OpenSSL"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hey, here are a few steps to create your own CA-signed certificates with your own CA:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create your CA:<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Generate the key:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">openssl genrsa -out CA.key 2048<br>openssl genrsa -out CA.key 2048 -des3 (with password protection)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u200bPlease note that if someone gets this key and it&#8217;s not password protected he can generate valid certificates in your name, which is really really bad, so keep it secret!<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Generate your CA certificate:<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">openssl req -new -x509 -extensions v3_ca -key CA.key -days 10000 -out CA.crt<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u200bThis creates a valid CA certificate wich is valid for 10000 days. Why so long? Because when this CA expires you have to revoke and regenerate all the certificates based on this one which could be timeconsuming, but feel free to set a lower number.&nbsp;<span style=\"line-height: 1.6em;\">In order to recognize your self-signed certificates this CA must be installed on your computer which calls the website or alike. which varies between operating systems and programs.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Generate the server certificate signing request (CSR):<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">openssl req -new -newkey rsa:2048 -key server.key -out server.csr -addext \"subjectAltName=DNS:www.domain.com,DNS:alt.dom.com,IP=1.2.3.4\"\u200b<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Please note that you need to specify the normal domain too (domain.com) in this file and as CommonName when generating the CSR.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sign your certificate with a CA:<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">openssl x509 -req -in server.csr -CA CA.crt -CAkey CA.key -out server.crt -days 365 -copy_extensions copy<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Quick generate a self-signed certificate:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In case you want the to do quickly a certificate including multiple names and IP addresses, you can do it also in one line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>openssl req -new -newkey rsa:2048 -days 365 -nodes -keyout server.key -out server.crt <\/code>-addext \"subjectAltName=DNS:name1,DNS:name2.dom.tld,IP:192.168.182.14\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u200bAll you have to do now is copy the <em>server.key<\/em>&nbsp;and <em>server.crt<\/em>&nbsp;onto your machine and configure your application to use this certificates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are some useful sites if found about SSL:<br><a href=\"http:\/\/www.chainsawonatireswing.com\/2013\/01\/28\/creating-self-signed-website-certificates-while-acting-as-your-own-certificate-authority\/#Create_the_root_key\" target=\"_blank\" rel=\"noopener\">http:\/\/www.chainsawonatireswing.com<\/a><br><a href=\"http:\/\/phaseshiftllc.com\/articles\/2008\/10\/27\/multiple-secure-subdomains-with-a-wildcard-ssl-certificate.html\" target=\"_blank\" rel=\"noopener\">http:\/\/phaseshiftllc.com<\/a><br><a href=\"http:\/\/blog.didierstevens.com\/2008\/12\/30\/howto-make-your-own-cert-with-openssl\/\" target=\"_blank\" rel=\"noopener\">http:\/\/blog.didierstevens.com<\/a><br><a href=\"http:\/\/shib.kuleuven.be\/docs\/ssl_commands.shtml\" target=\"_blank\" rel=\"noopener\">http:\/\/shib.kuleuven.be<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, here are a few steps to create your own CA-signed certificates with your own CA: Create your CA: Generate the key: openssl genrsa -out CA.key 2048openssl genrsa -out CA.key 2048 -des3 (with password protection) \u200bPlease note that if someone gets this key and it&#8217;s not password protected he can generate valid certificates in your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,10,7,9],"tags":[],"class_list":["post-441","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-mac-osx","category-servers","category-windows"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/441","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=441"}],"version-history":[{"count":7,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/441\/revisions"}],"predecessor-version":[{"id":1409,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/441\/revisions\/1409"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}