~~NOCACHE~~ ~~DISCUSSION~~ ## 証明書を利用した暗号化-復号化 [[https://www.xlsoft.com/jp/products/pkware/software/securezip/index.html|SecureZIP]]で自己証明書(オレオレ証明書)を利用した暗号化/復号化を試してみたんです。 簡単に図にすると以下のようになります。(証明書はOpenSSLを利用して作成しています) {{:OtherTechnical:SecureZIP:pasted:20211112-124446.png?direct 1000x0}} ### 暗号化する端末 ①pg.mnztech.work.crt(公開鍵+認証局署名入り証明書)を証明書ストアにインポートします。(証明書のインポートは割愛) ②SecureZIPで暗号化(zip化)する際に、インポートした証明書を指定します。 {{:OtherTechnical:SecureZIP:pasted:20211112-102511.png?direct 800x0}} ③秘密鍵を含まない証明書で暗号化すると注意喚起のポップアップが上がります。  注意喚起なだけなので、[OK]をクリックしてZIP化します。 {{:OtherTechnical:SecureZIP:pasted:20211112-102523.png?direct 800x0}} ④証明書で暗号化したZIPファイルが作成されます。 暗号化の際に複数の証明書を指定できる為、「復号化が可能な受信者一覧に、指定した証明書を登録されたZIPが作成されます。」の方が正しいかもしれない。 ### 復号化する端末 ①pg.mnztech.work.p12(秘密鍵+公開鍵+認証局署名入り証明書)を証明書ストアにインポートします。(証明書のインポートは割愛) ②特に複雑な操作は必要なく、証明書がインポートされていれば解凍可能です。 {{:OtherTechnical:SecureZIP:pasted:20211112-103551.png?direct 800x0}} ※証明書がインポートされていなかったり、秘密鍵を含まない証明書しか証明書ストアに無い場合は下記のようにエラーが表示され解凍できません。 {{:OtherTechnical:SecureZIP:pasted:20211112-103808.png?direct 400x0}} ### 参考(OpenSSLのコマンド例):秘密鍵→公開鍵+証明書署名要求→公開鍵+署名入り証明書→秘密鍵+公開鍵+署名入り証明書 openssl genrsa -des3 -out pg.mnztech.work.key 2048 #Enter PEM pass phrase: #Verifying - Enter PEM pass phrase: openssl req -new -key pg.mnztech.work.key -out pg.mnztech.work.csr #Enter pass phrase for pg.mnztech.work.key: #You are about to be asked to enter information that will be incorporatedinto 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 blankFor 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]:Tokyo #Locality Name (eg, city) []:Minato-ku #Organization Name (eg, company) [Internet Widgits Pty Ltd]:mnztech.work #Organizational Unit Name (eg, section) []: #Common Name (e.g. server FQDN or YOUR name) []:pg.mnztech.work #Email Address []: #Please enter the following 'extra' attributes #to be sent with your certificate request #A challenge password []: #An optional company name []: openssl x509 -req -days 365 -sha1 -in pg.mnztech.work.csr -signkey pg.mnztech.work.key -out pg.mnztech.work.crt #Enter pass phrase for pg.mnztech.work.key: openssl pkcs12 -export -out pg.mnztech.work.p12 -inkey pg.mnztech.work.key -in pg.mnztech.work.crt #Enter pass phrase for pg.mnztech.work.key: #Enter Export Password: #Verifying - Enter Export Password: ### 参考(OpenSSLのコマンド例):公開鍵+署名入り証明書をPKCS#7形式に変換(X.509→PKCS#7) openssl crl2pkcs7 -certfile pg.mnztech.work.crt -out pg.mnztech.work.p7b -nocrl ### 参考にしたサイト https://akisoftware.com/cgi-bin/blom.exe?akisoft+sl+2df3bf285450ec962202070ee9f87c3591c3d74f https://weblabo.oscasierra.net/openssl-gencert-1/ https://qiita.com/kunichiko/items/12cbccaadcbf41c72735 https://docs.vmware.com/jp/VMware-Horizon-7/7.13/horizon-scenarios-ssl-certificates/GUID-17AD1631-E6D6-4853-8D9B-8E481BE2CC68.html {{tag>AWS SecureZIP SSL証明書}}