gpt4 book ai didi

windows - 如何在 windows web 服务器 2008 R2 64 位上加密 SSL paypal 按钮,

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:22 25 4
gpt4 key购买 nike

我尝试在我的 Windows Web 服务器 2008 R2 64 位上使用 SSL paypal 按钮进行加密。我已经安装了 apache 2.2.22、php 5.4.3 和 openssl。

我在 ssl paypal 按钮中找到要加密的类,但它不起作用。我没有任何错误,只是按钮代码没有加密。

要加密的类:

<?php


class PaypalCrypt{

private $privateKey = '';
private $publicKey = '';
private $paypalKey = '';
//private $pathOpenSSL = '/usr/bin/openssl';
private $pathOpenSSL = 'C:/wamp/bin/apache/apache2.2.22/bin/openssl.exe';
private $data = array(
'bn' => 'Boutique_BuyNow_WPS_FR',
'cmd' => '_xclick',
'lc' => 'FR',
'custom' => '',
'invoice' => '',
'currency_code' => 'EUR',
'charset' => 'UTF-8', //Définit le charset utilisé sur le site
'no_shipping' => '1'
);

public function __construct(){
// Nothing
}

public function addData($key, $data){
$this->data[$key] = $data;
return $this;
}

public function setPrivateKey($privateKey){
$this->privateKey = $privateKey;
return $this;
}

public function setPublicKey($publicKey){
$this->publicKey = $publicKey;
return $this;
}

public function setPaypalKey($paypalKey){
$this->paypalKey = $paypalKey;
return $this;
}

public function getCryptedData(){
if (!file_exists($this->privateKey))
throw new Exception('ERROR: MY_KEY_FILE '.$this->privateKey.' not found');
if (!file_exists($this->publicKey))
throw new Exception('ERROR: MY_CERT_FILE '.$this->publicKey.' not found');
if (!file_exists($this->paypalKey))
throw new Exception('ERROR: PAYPAL_CERT_FILE '.$this->paypalKey.' not found');

$openssl_cmd = "$this->pathOpenSSL smime -sign -signer $this->publicKey -inkey $this->privateKey ".
"-outform der -nodetach -binary| $this->pathOpenSSL smime -encrypt ".
"-des3 -binary -outform pem $this->paypalKey";

$descriptors = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
);

$process = proc_open($openssl_cmd, $descriptors, $pipes);
if (is_resource($process)) {
foreach ($this->data as $key => &$value)
if ($value != "")
fwrite($pipes[0], "$key=$value\n");
fflush($pipes[0]);
fclose($pipes[0]);

$output = "";
while (!feof($pipes[1]))
$output .= fgets($pipes[1]);

fclose($pipes[1]);
$return_value = proc_close($process);
return $output;
}
throw new Exception('ERROR: encryption failed');
}

public function setOpenSSLPath($path){
if(!file_exists($path))
throw new Exception('OpenSSLPath "'.$path.'" don\'t exists');
$this->pathOpenSSL = $path;
}
}


$MY_KEY_FILE = "prvkey.pem";

# public certificate file to use
$MY_CERT_FILE = "pubcert.pem";

# Paypal?s public certificate
$PAYPAL_CERT_FILE = "paypal_cert.pem";


// Initialisation cryptage Paypal
$paypalCrypt = new PaypalCrypt();
$paypalCrypt->setPrivateKey($MY_KEY_FILE);
$paypalCrypt->setPublicKey($MY_CERT_FILE);
$paypalCrypt->setPaypalKey($PAYPAL_CERT_FILE);
$paypalCrypt->addData('cert_id','id_certificat_fourni_par_paypal')
->addData('business','email@email.com')
->addData('no_note','1')
->addData('shipping','0')
->addData('tax','0')
->addData('rm','2')
->addData('cbt','Retour sur la boutique')
->addData('custom','id_membre')
->addData('return','http://mon_site.com/return.php')
->addData('cancel_return','http://mon_site.com/cancel.php')
->addData('notify_url','http://mon_site.com/ipn.php')
->addData('amount','10')
->addData('item_name', 'Boite à meuh')
->addData('item_number', 'identifiant_produit');
$data = $paypalCrypt->getCryptedData();

?>
<form action="https://www.paypal.com/fr/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="<?php echo $data?>"/>
<input type="submit" value="Commander" class="input_button">
</form>

我不知道为什么它不能在 windows 上运行,但它可以在 1and1(linux?)上运行

非常感谢亲切地

最佳答案

我今晚找到了解决方案。事实上,解决方案是在没有命令 openssl 的情况下使用 PHP 来加密 SSL paypal 按钮。 Paypal 给出了一个使用它的例子: https://cms.paypal.com/fr/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks#WPST并下载网站支付标准工具包。

非常感谢再见

关于windows - 如何在 windows web 服务器 2008 R2 64 位上加密 SSL paypal 按钮,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14517512/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com