公開鍵暗号
PHPで暗号化して,opensslのコマンドを使って,復号化する.
php はコンパイル時に --with-openssl=[PATH] をつける必要がある.
$ php5 -r ' $publicKey = "file:///usr/local/apache/conf/ssl.crt/server.crt"; $plaintext = "String to encrypt"; openssl_public_encrypt($plaintext, $encrypted, $publicKey); echo chunk_split(base64_encode($encrypted)); ' | openssl base64 -d | openssl rsautl -inkey /usr/local/apache/conf/ssl.key/server.key -in encrypted.txt -decrypt