30 lines
1.4 KiB
Java
30 lines
1.4 KiB
Java
|
package o;
|
||
|
|
||
|
import cn.wind.smjce.crypto.engines.SM4Engine;
|
||
|
import cn.wind.smjce.crypto.modes.CBCBlockCipher;
|
||
|
import cn.wind.smjce.crypto.paddings.PKCS7Padding;
|
||
|
import cn.wind.smjce.crypto.paddings.PaddedBufferedBlockCipher;
|
||
|
import cn.wind.smjce.crypto.params.KeyParameter;
|
||
|
import cn.wind.smjce.crypto.params.ParametersWithIV;
|
||
|
|
||
|
/* renamed from: o.XVy, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public final class C1166XVy {
|
||
|
public static byte[] e(byte[] bArr, byte[] bArr2, byte[] bArr3) {
|
||
|
try {
|
||
|
PaddedBufferedBlockCipher paddedBufferedBlockCipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new SM4Engine()), new PKCS7Padding());
|
||
|
paddedBufferedBlockCipher.init(true, new ParametersWithIV(new KeyParameter(bArr), bArr3));
|
||
|
byte[] bArr4 = new byte[paddedBufferedBlockCipher.getOutputSize(bArr2.length)];
|
||
|
int processBytes = paddedBufferedBlockCipher.processBytes(bArr2, 0, bArr2.length, bArr4, 0);
|
||
|
int doFinal = processBytes + paddedBufferedBlockCipher.doFinal(bArr4, processBytes);
|
||
|
byte[] bArr5 = new byte[doFinal];
|
||
|
System.arraycopy(bArr4, 0, bArr5, 0, doFinal);
|
||
|
return bArr5;
|
||
|
} catch (Exception e) {
|
||
|
StringBuilder sb = new StringBuilder("Exception in encryptSm4CbcPkcs7, msg=");
|
||
|
sb.append(e.getMessage());
|
||
|
throw new RuntimeException(sb.toString(), e);
|
||
|
}
|
||
|
}
|
||
|
}
|