src/Crypt/RSA/MultiBase.php
public function decrypt($data, $key)
    {
        if ($data === null || $data === '') {
            return $data;
        }

        $encryptPieCollector = @json_decode(base64_decode($data), true);
        if (!is_array($encryptPieCollector)) {
            return null;
        }

        $decryptPieCollector = [];
        foreach ($encryptPieCollector as $encryptPie) {
            $base64DecryptPie = @base64_decode($encryptPie);
            if ($base64DecryptPie === false) {
                return null;
            }
            $decryptPie = $this->doDecrypt($base64DecryptPie, $key);
            if ($decryptPie === null) {
                return null;
            }
            $decryptPieCollector[] = $decryptPie;
        }

        $decryptData = implode('', $decryptPieCollector);

        $rs = @base64_decode($decryptData);

        return $rs !== false ? $rs : null;
    }
public function decrypt($data, $key)
    {
        if ($data === null || $data === '') {
            return $data;
        }

        $encryptPieCollector = @json_decode(base64_decode($data), true);
        if (!is_array($encryptPieCollector)) {
            return null;
        }

        $decryptPieCollector = [];
        foreach ($encryptPieCollector as $encryptPie) {
            $base64DecryptPie = @base64_decode($encryptPie);
            if ($base64DecryptPie === false) {
                return null;
            }
            $decryptPie = $this->doDecrypt($base64DecryptPie, $key);
            if ($decryptPie === null) {
                return null;
            }
            $decryptPieCollector[] = $decryptPie;
        }

        $decryptData = implode('', $decryptPieCollector);

        $rs = @base64_decode($decryptData);

        return $rs !== false ? $rs : null;
    }
public function decrypt ( $ data , $ key ) { if ( $ data === null || $ data === '' ) { return $ data ; } $ encryptPieCollector = @ json_decode ( base64_decode ( $ data ) , true ) ; if ( ! is_array ( $ encryptPieCollector ) ) { return null ; } $ decryptPieCollector = [ ] ; foreach ( $ encryptPieCollector as $ encryptPie ) { $ base64DecryptPie = @ base64_decode ( $ encryptPie ) ; if ( $ base64DecryptPie === false ) { return null ; } $ decryptPie = $ this -> doDecrypt ( $ base64DecryptPie , $ key ) ; if ( $ decryptPie === null ) { return null ; } $ decryptPieCollector [ ] = $ decryptPie ; } $ decryptData = implode ( '' , $ decryptPieCollector ) ; $ rs = @ base64_decode ( $ decryptData ) ; return $ rs !== false ? $ rs : null ; }
解密

@param string $data 待解密的字符串
@param string $key 公钥/私钥
@return string|null 失败时返回null
解密