hlf_513/dingtalk-crypto

钉钉开放平台加解密消息体(openssl版本)

1.0 2018-01-15 06:22 UTC

This package is not auto-updated.

Last update: 2025-01-19 07:01:02 UTC


README

钉钉开放平台的消息体加解密(openssl加密版本);因为php7以后mcrypt扩展被舍弃

Install

composer require hlf_513/dingtalk-crypto

Usage

$crypto = new Crypto(
    $token,
    $encodingAesKey,
    $suiteKey
);

$string = 'success';
$timestamp = '1515664989185';
$nonce = '53IP1CdM';

// 加密
$ret = $crypto->encryptMsg($string, $timestamp, $nonce);
$ret = json_decode($ret, 1);
// 解密
$ret = $crypto->decryptMsg($ret['msg_signature'], $timestamp, $nonce, $ret['encrypt']);
// output: $ret === 'success'