41 lines
1.4 KiB
Java
41 lines
1.4 KiB
Java
package com.tencent.bugly.proguard;
|
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
import javax.crypto.Cipher;
|
|
import javax.crypto.SecretKeyFactory;
|
|
import javax.crypto.spec.DESKeySpec;
|
|
import javax.crypto.spec.IvParameterSpec;
|
|
|
|
/* compiled from: BUGLY */
|
|
/* loaded from: classes.dex */
|
|
public final class ai implements aj {
|
|
private String a = null;
|
|
|
|
@Override // com.tencent.bugly.proguard.aj
|
|
public final byte[] a(byte[] bArr) throws Exception {
|
|
if (this.a == null || bArr == null) {
|
|
return null;
|
|
}
|
|
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
|
cipher.init(2, SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(this.a.getBytes("UTF-8"))), new IvParameterSpec(this.a.getBytes("UTF-8")));
|
|
return cipher.doFinal(bArr);
|
|
}
|
|
|
|
@Override // com.tencent.bugly.proguard.aj
|
|
public final byte[] b(byte[] bArr) throws Exception, NoSuchAlgorithmException {
|
|
if (this.a == null || bArr == null) {
|
|
return null;
|
|
}
|
|
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
|
cipher.init(1, SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(this.a.getBytes("UTF-8"))), new IvParameterSpec(this.a.getBytes("UTF-8")));
|
|
return cipher.doFinal(bArr);
|
|
}
|
|
|
|
@Override // com.tencent.bugly.proguard.aj
|
|
public final void a(String str) {
|
|
if (str != null) {
|
|
this.a = str;
|
|
}
|
|
}
|
|
}
|