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: 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'