# 密码学算法

本章主要介绍 X5 信息安全密码学算法的使用方法。X5 支持多个 `crypto` 接口库，用户可根据使用算法和使用场景，来选择对应的接口库，调用 X5 提供的 `crypto` 算法。目前支持的接口库包括： `libkcapi` 和 `OpenSSL Engine`。

## <span id="algorithms-list"/> 当前支持算法

目前，用户仅能调用运行在 `REE(Rich Execution Environment)` 侧的算法，`REE` 支持的密码学算法类型如下：

| 算法类型   | 算法名称  | 秘钥长度      | 硬件类型 | 硬件IP对数据长度的限制 |
|-----------|---------- |--------------|----------|---------------------|
| 对称加解密 |  ecb(aes) | 128/192/256  | te600    | /                   |
| 对称加解密 |  cbc(aes) | 128/192/256  | te600    | /                   |
| 对称加解密 |  ctr(aes) | 128/192/256  | te600    | /                   |
| 对称加解密 |  ofb(aes) | 128/192/256  | te600    | /                   |
| 对称加解密 |  xts(aes) | 128/256      | te600    | /                   |
| 对称加解密 |  ecb(sm4) | 128          | te600    | /                   |
| 对称加解密 |  cbc(sm4) | 128          | te600    | /                   |
| 对称加解密 |  ctr(sm4) | 128          | te600    | /                   |
| 对称加解密 |  ofb(sm4) | 128          | te600    | /                   |
| hash摘要算法 |  sha1   | /            | te600    | /                   |
| hash摘要算法 |  sha224 | /            | te600    | /                   |
| hash摘要算法 |  sha256 | /            | te600    | /                   |
| hash摘要算法 |  sha384 | /            | te600    | /                   |
| hash摘要算法 |  sha512 | /            | te600    | /                   |
| hash摘要算法 |  sm3    | /            | te600    | /                   |
| hash摘要算法 |  md5    | /            | te600    | /                   |
