zoukankan      html  css  js  c++  java
  • openssl

    header("content-Type: text/html; charset=UTF-8");
    $private = '-----BEGIN RSA PRIVATE KEY-----
    MIICXQIBAAKBgQDn36LGQvqZMB0AH4IIw6QYLChRr7I2V3BWcAUU42rB/RlYvOoE
    bpyOnf8c5+r2RsspVXA0ldp77Ph5DH2e9GzBrFzHe6Z7aW8ipXo/PU8BKEIV5Kk4
    xSyJ0C5EeuKXThO4FJCrU7nJAcRB4nlbvKn5ZkLJ5kjgWbQodzS1nG0bxwIDAQAB
    AoGBAJ2mETeXJmasrar9wR1QVusQasFPIW2M+ZXrR6kyDc2i1W7d0oX85niYt3Dh
    xYB4FX0e19EI6alELpOuiGJgcOfZeckyIsOTuDuSj4DLkWDu9/V/Xe5ydop6sNnM
    Qe7PSati7um/JkyEJ8bLIsbtR89ciNgBEmNV5IuOJcPYTznxAkEA+G1AKxs7BoSy
    doXcQqvkz2ayuzsNCnurDTlZXM+LOkqw60kY8LS8EClC6yS8udyfHfftfivIoXQU
    2jWMwSzHlQJBAO7xM80Uarz1IOqaJJE1ovJMQdq2FI/WLMOyKp6w0azB5l//DOwx
    2sACmgP+5o0lLvXwFPDuMm8RLMv5b/LYzusCQQCCsn+S7iWUnVWCs5QY43RihSY9
    CKkovb1VHLnd8TbPeSIw9ukPIhba7cpOCarcoax4yMoCmihYgMjDsG6X5uYtAkBu
    9a/akpqmuSbaC07j6AaNgoAqctfFm+4Zyskj/HTCRyEWfzifDt/IvuyK4npqHVRb
    fWwcHmFpVo55ApLMMYaVAkBHO367nRADOUfU7l7yTR0DQa+7gsFhceVys6uIscDv
    3xgGg7U8t9N93I37UmA9xRYDCggjqeeUte4lgwFdm1PP
    -----END RSA PRIVATE KEY-----';
    $public_key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDn36LGQvqZMB0AH4IIw6QYLChR
    r7I2V3BWcAUU42rB/RlYvOoEbpyOnf8c5+r2RsspVXA0ldp77Ph5DH2e9GzBrFzH
    e6Z7aW8ipXo/PU8BKEIV5Kk4xSyJ0C5EeuKXThO4FJCrU7nJAcRB4nlbvKn5ZkLJ
    5kjgWbQodzS1nG0bxwIDAQAB';
    
    $data = 'body=西安市莲湖区家艺鲜水果店&is_raw=1&mch_create_ip=119.61.18.42&mch_id=102575538650&nonce_str=jvmperv23jon7r3hzyqm8cnd0fzdmiel&notify_url=https://mall.epaikj.com/wap/paynotice.php&out_trade_no=20180226163453185983&service=pay.weixin.jspay&sub_appid=wx7941ffea4379e027&sub_openid=oa21fw298nFUzDlUkpA_mN8BjaP8&total_fee=610';
    $res = openssl_get_privatekey($private);
    openssl_sign($data, $sign, $res, OPENSSL_ALGO_SHA256);
    openssl_free_key($res);
    $sign = base64_encode($sign);
    //echo $sign;
    $pkeyid = openssl_pkey_get_public($public_key);
    $verify = (bool)openssl_verify($data, base64_decode($sign), $pkeyid, OPENSSL_ALGO_SHA256);
    openssl_free_key($pkeyid);
    var_dump($verify);
    

     秘钥生成

  • 相关阅读:
    讨论: 在WebControl中的Button,同时有onClientClick和onclick事件,验证控件实效
    在DropDownList中显示树形结构
    我的软件开场白+简单的通讯录
    DataList中动态添加控件遇到的问题
    伤心啊!不知道怎么感冒了
    存储过程实现无限级分类(2)
    上传文件类
    一个用泛型,和Sql语句分页的源代码
    在GridView中用Js实现全选
    [转]如何完美应对面试
  • 原文地址:https://www.cnblogs.com/lujiang/p/8474066.html
Copyright © 2011-2022 走看看