微信第三方平台消息解密遇到问题,求助!

    $msg_signature  = $_GET['msg_signature'];
    $timestamp  = $_GET['timestamp'];
    $nonce  = $_GET['nonce'];
    $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
    $encrypt_type = $_GET['encrypt_type'];

    if (!empty($postStr)) {

        //如果是加密模式
        if($encrypt_type == "aes"){
            $wxcpt = new WXBizMsgCrypt(TOKEN, EncodingAESKey, AppID);
            $sMsg = "";  //解析之后的明文
            $errCode = $wxcpt->decryptMsg($msg_signature, $timestamp, $nonce, urlencode($postStr), $sMsg);

之前postStr没有urlencode时,decryptMsg函数没有返回值。现在加了urlencode,errCode为40001(不合法的调用凭证)。可是TOKEN、EncodingAESKey和AppID已经核对过了没有错。求助!

第三方要看对方的加密方法是什么,具体咨询下

这是微信官方给的函数,用的aes加密。不知道为什么在我使用时出现这个问题,困扰我好久了。