(SM4_Context ctx, byte[] key)
| 211 | } |
| 212 | |
| 213 | public void sm4_setkey_enc(SM4_Context ctx, byte[] key) throws Exception { |
| 214 | if (ctx == null) { |
| 215 | throw new Exception("ctx is null!"); |
| 216 | } |
| 217 | |
| 218 | if (key == null || key.length != 16) { |
| 219 | throw new Exception("key error!"); |
| 220 | } |
| 221 | |
| 222 | ctx.mode = SM4_ENCRYPT; |
| 223 | sm4_setkey(ctx.sk, key); |
| 224 | } |
| 225 | |
| 226 | public void sm4_setkey_dec(SM4_Context ctx, byte[] key) throws Exception { |
| 227 | if (ctx == null) { |
no test coverage detected