#decryption #crypto

wecom-crypto

企业微信API数据加解密库。

10 releases

0.1.9 Apr 6, 2024
0.1.8 Mar 21, 2024
0.1.6 Feb 22, 2024

#913 in Cryptography

Download history 6/week @ 2024-09-27 2/week @ 2024-10-04

871 downloads per month

MIT/Apache

10KB
129 lines

wecom-crypto

wecom-crypto提供了企业微信API数据的加解密功能。其实现完全遵循官方文档中的规定。

使用方法

use wecom_crypto::{CryptoAgent, CryptoSource};

let key = "cGCVnNJRgRu6wDgo7gxG2diBovGnRQq1Tqy4Rm4V4qF";
let agent = CryptoAgent::new(key);
let source = CryptoSource {
    text: "hello world!".to_string(),
    receive_id: "wandering-ai".to_string(),
};
let enc = agent.encrypt(&source);
let dec = agent.decrypt(enc.as_str()).unwrap();
assert_eq!(source, dec);

lib.rs:

wecom-crypto

wecom-crypto提供了企业微信API数据的加解密功能。其实现完全遵循官方文档中的规定。

使用方法

use wecom_crypto::{Agent, Source};

let token = "a";
let key = "cGCVnNJRgRu6wDgo7gxG2diBovGnRQq1Tqy4Rm4V4qF";
let agent = Agent::new(token, key);
let source = Source {
    text: "hello world!".to_string(),
    receive_id: "wandering-ai".to_string(),
};
let enc = agent.encrypt(&source);
let dec = agent.decrypt(enc.as_str()).unwrap();
assert_eq!(source, dec);

Dependencies

~1.4–2MB
~43K SLoC