柳暗花明笔记

    shopex踩坑记

    所属分类:[ php&web ] 猫哲学家 发表于:2017-11-12 00:50 浏览:67

    1.windows下php5.3可以成功安装shopex,签名不能成功, openssl_get_privatekey failed. error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag openssl_get_privatekey failed.string(54) "error:0906D06C:PEM routines:PEM_read_bio:no start line"
    2.windows php5.6可以签名成功,但不能安装shopex,shopex官方只提供到php5.3
    3. shopex linux Zend Optimizer!!!!! => php5.3 Zend Guard Loader OK
    4.windows php5.6可以签名成功,但不能安装shopex,shopex官方只提供到php5.3
    5.在linux系统下,php5.3可以成功安装shopex,签名也能成功,一切正常
    6.杀手锏 windows下php5.3 shopex openssl_sign 使用古老的Crypt/RSA.php
    function sign($strData, $privateKey)
    {
    include('./Crypt/RSA.php');
    var_dump($privateKey);
    $rsa = new Crypt_RSA();
    $rsa->loadKey($privateKey);
    if (!openssl_get_privatekey($rsa)) {
    echo 'encryptTaiping openssl_get_privatekey failed.';
    var_dump(openssl_error_string());
    return false;
    }
    //$rsa->setSignatureMode(OPENSSL_ALGO_MD5);
    //$signature = $rsa->sign($strData);
    //return base64_encode($signature);

    $signature = '';
    // if (!openssl_sign($strData, $signature, $privateKey, OPENSSL_ALGO_MD5)) {
    if (!openssl_sign($strData, $signature, $rsa, OPENSSL_ALGO_MD5)) {
    echo 'openssl_sign failed.';
    return false;
    }
    $signature = base64_encode($signature);
    return $signature;
    }

    标签: php 
    上一编文章 git tag 打标签及推送标签 下一编文章 PHP Fatal error: Uncaught exception 'Exception' with message
    最近文章
    发表评论