hlf_513/dingtalk-crypto

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

Installs: 24

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/hlf_513/dingtalk-crypto

1.0 2018-01-15 06:22 UTC

This package is not auto-updated.

Last update: 2025-09-28 10:32:08 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'