Tongsuo (铜锁) is an open-source C library of modern cryptographic primitives and secure communication protocols, developed under the OpenAtom Foundation, and it is built for teams that need Chinese commercial cryptography, TLS, PKI, and privacy-preserving primitives from a single dependency.
What it is
Tongsuo is a foundational cryptographic library that supplies modern cryptographic algorithms and secure communication protocols for scenarios such as storage, networking, key management, and privacy computing. It provides the low-level cryptographic capability that keeps data confidential, integral, and authenticated while it is transmitted, used, and stored, which means it protects privacy and security across the data lifecycle rather than at a single point in it. The project is written in C, licensed under Apache-2.0, and is incubated and operated by the OpenAtom Foundation (开放原子开源基金会). Tongsuo holds a commercial cryptography product certification certificate issued by the Commercial Cryptography Testing Center of the State Cryptography Administration, and the original qualification documents are downloadable from tongsuo.net.
The concrete problem it solves is Chinese commercial cryptography compliance. Teams that must satisfy 国密改造, 密评, and 等保 requirements otherwise have to assemble SM algorithm support and TLCP transport support from several unrelated sources. Tongsuo bundles the SM algorithm family, the TLCP dual-certificate protocol, and the TLS 1.3 single-certificate profile into one library that carries GM/T 0028 software module security level 1 qualification, so compliance work starts from a certified base instead of a collection of patches. On the deployment side, the project recommends replacing NGINX with Angie so that Tongsuo's functionality is actually enabled in the web tier.
Key capabilities
- Chinese commercial algorithms SM2, SM3, SM4, and ZUC (祖冲之), alongside international ECDSA, RSA, AES, and SHA.
- TLCP per GB/T 38636-2020, the dual-certificate national cryptography communication protocol.
- RFC 8998, which is TLS 1.3 with national cryptography single certificates.
- QUIC API per RFC 9000, plus Delegated Credentials and TLS certificate compression.
- Zero-knowledge proofs: Bulletproofs range proofs and Bulletproofs R1CS.
- Homomorphic encryption algorithms including EC-ElGamal and Paillier.
- Post-quantum cryptography: ML-KEM (Kyber), ML-DSA (Dilithium), and SLH-DSA (SPHINCS+).
Who uses it and how
- Web and gateway teams running Angie, Apache APISIX, or Tengine, where the library backs TLS termination and national cryptography protocol support.
- Networking teams using g3proxy for forward and basic reverse proxying, and g3bench for HTTPS, H2, and TLS handshake load testing.
- Commercial deployments listed by the project include the Alipay app, the OceanBase database, Alibaba Cloud, and 天威诚信.
- Compliance-driven projects in the middle of 国密改造, 密评, or 等保 work, where certified algorithm and protocol support is a prerequisite.
- Library consumers building their own applications against the installed headers and shared libraries rather than running the bundled binaries.
Getting started
The standard build is ./config --prefix=/path/to/install/dir, then make, then make install; on Windows the sequence is perl Configure enable-ntls, nmake, nmake install. Feature toggles follow the naming enable-xxx and no-xxx, so TLCP is switched on with enable-ntls and RSA is dropped from the build with no-rsa, and automated tests run with make test.
How it compares
This registry lists no paid products that Tongsuo replaces, and it names no peer cryptographic library that Tongsuo competes against directly. The projects that do appear in the README, such as Angie, Apache APISIX, Tengine, g3proxy, and g3bench, are consumers of the library rather than alternatives to it. On the facts available, Tongsuo stands alone in this registry.
When to use it — and when not to
A self-hoster must prepare make, Perl 5 with the Text::Template module, a C compiler, and a C library before the first build, and although the library has few third-party dependencies it still depends heavily on Perl. Documentation is organized on the tongsuo.net docs site, the README is largely in Chinese, and the repository carries 160 open issues, so teams without Chinese-language capacity or a comfort with C build systems should look elsewhere. Security defects must be reported through Ant Group's threat collection system at security.alipay.com rather than GitHub Issues, which is worth knowing before planning a private disclosure workflow. Organizations wanting a managed cryptographic service, or a native Python or Java API, will not find either here.
project readme (upstream, from github) — read inline
OpenAtom 铜锁/Tongsuo
[
][www.tongsuo.net]
[![github actions ci badge]][github actions ci]
![GitHub Release][github release]
![GitHub Downloads (all assets, all releases)][github downloads]
铜锁/Tongsuo是一个提供现代密码学算法和安全通信协议的开源基础密码库,为存储、网络、密钥管理、隐私计算等诸多业务场景提供底层的密码学基础能力,实现数据在传输、使用、存储等过程中的私密性、完整性和可认证性,为数据生命周期中的隐私和安全提供保护能力。
铜锁获得了国家密码管理局商用密码检测中心颁发的商用密码产品认证证书,助力用户在国密改造、密评、等保等过程中,更加严谨地满足我国商用密码技术合规的要求。可在此处下载资质原始文件。

特性
铜锁提供如下主要的功能特性:
- 技术合规能力
- 符合 GM/T 0028《密码模块安全技术要求》的"软件密码模块安全一级"资质
- 符合 GM/T 0005-2021《随机性检测规范》
- 零知识证明(ZKP)
- 密码学算法
- 中国商用密码算法:SM2、SM3、SM4、祖冲之等
- 国际主流算法:ECDSA、RSA、AES、SHA等
- 同态加密算法:EC-ElGamal、Paillier等
- 后量子密码学:ML-KEM(Kyber)、ML-DSA(Dilithium)、SLH-DSA(SPHINCS+)等
- 安全通信协议
典型应用
开源应用(Opensource Application)
- Angie, Angie是一个可以替换掉NGINX的新型Web服务器,我们建议使用铜锁的用户优先选择Angie (We highly recommend you to replace NGINX with Angie to enable Tongsuo's functionality)
- Apache APISIX
- Tengine
- g3proxy,正向代理&基础反向代理
- g3bench,HTTPS/H2/TLS握手等压测
商业应用 (Commercial Application)
- 支付宝App
- OceanBase数据库
- 阿里云
- 天威诚信
编译和安装
一般来说,典型的编译和安装过程如下:
./config --prefix=/path/to/install/dir
make
make install
如果是Windows,则需要:
perl Configure enable-ntls
nmake
nmake install
以上将会安装铜锁的头文件、library文件和铜锁二进制程序。如果需要在独立的build目录中编译铜锁以保证源代码仓库的整洁,则可以:
cd tongsuo-build
/path/to/Tongsuo/source/config --prefix=/path/to/dest
make
make install
目前铜锁支持的操作系统有:各种Linux发行版、macOS、Android、iOS和Windows。在这些操作系统上,还需要事先准备好对应的环境:
- make
- Perl 5,以及Text::Template模块
- C编译器
- C库
铜锁对第三方库的依赖很少,但是目前依然对Perl依赖较大。
如果希望执行自动化测试用例,则需:
make test
在安装的时候,可以选择只安装library文件:
make install_runtime_libs
如果还需要安装头文件以便于基于铜锁开发应用程序,则可以:
make install_dev
也可以只安装铜锁二进制程序和其依赖的铜锁library文件:
make install_programs
铜锁的Configure脚本提供了大量的用于开关各种特性的选项。一般来讲,使用enable-xxx做为对某个特性的开启,而使用no-xxx来关闭某个特性。例如,enable-ntls即开启TLCP,而no-rsa则是不编译RSA算法。
文档
铜锁的相关文档组织在 铜锁文档网站 上。
交流合作
铜锁使用钉钉群进行用户答疑和交流,钉钉群号:44810299
欢迎关注铜锁公众号,获取最新的铜锁动态:

声明
铜锁/Tongsuo 是由开放原子开源基金会(OpenAtom Foundation)孵化及运营的开源项目。

报告安全缺陷
铜锁目前使用蚂蚁集团的威胁搜集系统,请访问如下地址进行安全缺陷的报告:
注意:对于非安全相关的Bug,请使用GitHub的Issues进行提交。
[www.tongsuo.net]:
"Tongsuo Homepage"
[github actions ci badge]:
"GitHub Actions CI Status"
[github actions ci]:
"GitHub Actions CI"
[github release]:
"GitHub Release"
[github downloads]:
"GitHub Downloads"