hlf_513 / dingtalk-crypto
钉钉开放平台加解密消息体(openssl版本)
1.0
2018-01-15 06:22 UTC
Requires
- php: >=7.0.0
- ext-openssl: >=0.9.8
Requires (Dev)
- phpunit/phpunit: ~6.5
This package is not auto-updated.
Last update: 2024-09-15 04:55:31 UTC
README
钉钉开放平台的消息体加解密(openssl加密版本);因为php7以后mcrypt扩展被废弃
安装
composer require hlf_513/dingtalk-crypto
用法
$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'