(SM4_Context ctx, byte[] key)
| 224 | } |
| 225 | |
| 226 | public void sm4_setkey_dec(SM4_Context ctx, byte[] key) throws Exception { |
| 227 | if (ctx == null) { |
| 228 | throw new Exception("ctx is null!"); |
| 229 | } |
| 230 | |
| 231 | if (key == null || key.length != 16) { |
| 232 | throw new Exception("key error!"); |
| 233 | } |
| 234 | |
| 235 | int i = 0; |
| 236 | ctx.mode = SM4_DECRYPT; |
| 237 | sm4_setkey(ctx.sk, key); |
| 238 | for (i = 0; i < 16; i++) { |
| 239 | SWAP(ctx.sk, i); |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | public byte[] sm4_crypt_ecb(SM4_Context ctx, byte[] input) throws Exception { |
| 244 | if (input == null) { |
no test coverage detected