如何用go实现如下php代码功能?

0 0 golang gou8bedu8a00
帅气丶月半
帅气丶月半

声望值:104 0人

2019-01-12 16:15:11 提问

关注 0关注

收藏 0收藏, 21浏览

<?php
    $private_key = "-----BEGIN RSA PRIVATE KEY-----
        MIICXAIBAAKBgQDFG/lh1FLEVF8J0AwZZvUQkISjS1m/nHRp3ZSgqH7C2O62ZBVn
    -----END RSA PRIVATE KEY-----";
    $ad_from = "111";
    $ids = "2202409872";
    $pi_key =  openssl_pkey_get_private($private_key);
    $str = "ad_from={$ad_from}&ids=[{$ids}]";
    //sign
    openssl_sign($str, $signature, $pi_key);
    $encrypted = base64_encode($signature);
    $encrypted = urlencode($encrypted);
    echo $encrypted;
?>
请先 登录 后评论

1个回答

注册新账号

悬赏追问
10
  • 10
  • 20
  • 50
  • 100
  • 200
  • 输入数值
发布追问