munakata@mvc:/etc/ssl/private2_for_client_certificate$ diff openssl-ca.cnf ../openssl.cnf 73c73 < default_days = 3650 # how long to certify for --- > default_days = 365 # how long to certify for 170c170 < basicConstraints=CA:TRUE --- > basicConstraints=CA:FALSE 183d182 < nsCertType = sslCA, emailCA 190d188 < keyUsage = cRLSign, keyCertSign 218d215 < keyUsage = cRLSign, keyCertSign
munakata@mvc:/etc/ssl/private2_for_client_certificate$ sudo openssl genrsa -des3 -out ca.key 2048 Generating RSA private key, 2048 bit long modulus (2 primes) ..............................+++++ ..............................................................................................................................................................................+++++ e is 65537 (0x010001) Enter pass phrase for ca.key: <-------------- magumaguking Verifying - Enter pass phrase for ca.key: <--- magumaguking munakata@mvc:/etc/ssl/private2_for_client_certificate$ ls -la 合計 52 drwxr-xr-x 2 root root 4096 10月 5 09:44 . drwxr-xr-x 12 root root 4096 9月 4 15:57 .. -r-------- 1 root root 1751 10月 5 09:49 ca.key -rw-r--r-- 1 root root 10927 10月 5 09:23 openssl-ca.cnf
munakata@mvc:/etc/ssl/private2_for_client_certificate$ sudo openssl req -new -x509 -days 3650 -sha256 -key ./ca.key -out ./ca.crt -config openssl-ca.cnf Enter pass phrase for ./ca.key: <--------- magumaguking You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:JP State or Province Name (full name) [Some-State]:Kanagawa Locality Name (eg, city) []:Yokohama Organization Name (eg, company) [Internet Widgits Pty Ltd]:IT Organizational Unit Name (eg, section) []:Admin Common Name (e.g. server FQDN or YOUR name) []:kgb.hmuna.com Email Address []:admin@hmuna.com munakata@mvc:/etc/ssl/private2_for_client_certificate$ ls -la 合計 28 drwxr-xr-x 2 root root 4096 10月 5 10:11 . drwxr-xr-x 12 root root 4096 9月 4 15:57 .. -rw-r--r-- 1 root root 1428 10月 5 10:11 ca.crt -r-------- 1 root root 1751 10月 5 09:49 ca.key -rw-r--r-- 1 root root 10927 10月 5 09:23 openssl-ca.cnf
munakata@mvc:/etc/ssl/private2_for_client_certificate$ sudo openssl x509 -inform pem -in ./ca.crt -outform der -out ./ca.der munakata@mvc:/etc/ssl/private2_for_client_certificate$ ls -la 合計 32 drwxr-xr-x 2 root root 4096 10月 5 10:16 . drwxr-xr-x 12 root root 4096 9月 4 15:57 .. -rw-r--r-- 1 root root 1428 10月 5 10:11 ca.crt -rw-r--r-- 1 root root 1012 10月 5 10:16 ca.der -r-------- 1 root root 1751 10月 5 09:49 ca.key -rw-r--r-- 1 root root 10927 10月 5 09:23 openssl-ca.cnf
munakata@mvc:/etc/ssl/private2_for_client_certificate$ sudo touch index.txt munakata@mvc:/etc/ssl/private2_for_client_certificate$ sudo sh -c "echo '1000' > serial" munakata@mvc:/etc/ssl/private2_for_client_certificate$ ls -al 合計 36 drwxr-xr-x 2 root root 4096 10月 5 10:28 . drwxr-xr-x 12 root root 4096 9月 4 15:57 .. -rw-r--r-- 1 root root 1428 10月 5 10:11 ca.crt -rw-r--r-- 1 root root 1012 10月 5 10:16 ca.der -r-------- 1 root root 1751 10月 5 09:49 ca.key -rw-r--r-- 1 root root 0 10月 5 10:26 index.txt -rw-r--r-- 1 root root 10927 10月 5 09:23 openssl-ca.cnf -rw-r--r-- 1 root root 5 10月 5 10:28 serial
munakata@mvc:/etc/ssl/private2_for_client_certificate$ sudo openssl req -new -config ./openssl-client.cnf -sha256 -keyout cl.key -out cl.csr Generating a RSA private key ..........................................+++++ ......+++++ writing new private key to 'cl.key' Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:JP State or Province Name (full name) [Some-State]:Kanagawa Locality Name (eg, city) []:Yokohama Organization Name (eg, company) [Internet Widgits Pty Ltd]:IT Organizational Unit Name (eg, section) []:Admin Common Name (e.g. server FQDN or YOUR name) []:nanamocha.com Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: