0

顧客データが関係しているので、これを安全に行いたいと思っています。

私は共有ホスティングを使用しているため、コマンドラインから GNUPG を使用していますが、PHP クラスは使用できません。したがって、私のコードは次のとおりです。

putenv("GNUPGHOME=/home/me/.gnupg");

$gpg = '/usr/bin/gpg';
$gpgrecipient = 'email';
$mailrecp = 'email';
$plain = 'Here is the encrypted Text Here is the encrypted Text Here is the
    encrypted Text Here is the encrypted Text Here is the encrypted Text Here is the
    encrypted Text Here is the encrypted Text Here is the encrypted Text Here is the  
    encrypted Text';



$encrypted = shell_exec("echo {$plain} | {$gpg} --no-auto-check-trustdb --lock-never -e -a -r {$gpgrecipient} ");

$plainでは、データの整合性を維持しながら をエスケープするにはどうすればよいでしょうか?

使用するだけescapeshellcmd()では、フォーマットが台無しになる傾向があります。

共有ホスティングの機密データであるため、何かをファイルに保存することに少し不安があります。

4

2 に答える 2

0

使ってみましたescapeshellargか?そしてecho、出力の文字列の最後に改行を追加するので、次を使用することをお勧めします-n: Demo

<?php

$gpg = '/usr/bin/gpg';
$gpgrecipient = 'email';
$mailrecp = 'email';
$plain = 'Here is the encrypted Text Here is the encrypted Text Here is the
    encrypted Text Here is the encrypted Text Here is the encrypted Text Here is the
    encrypted Text Here is the encrypted Text Here is the encrypted Text Here is the  
    encrypted Text';


$plain = escapeshellarg($plain);

$cmd = "echo -n {$plain} | {$gpg} --no-auto-check-trustdb --lock-never -e -a -r {$gpgrecipient} ";

echo $cmd;
于 2011-09-12T23:19:48.833 に答える