66 lines
2.5 KiB
Java
66 lines
2.5 KiB
Java
|
package o;
|
||
|
|
||
|
import com.eracom.OBM2.NoSuchAlgorithmException;
|
||
|
import java.security.MessageDigest;
|
||
|
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
|
||
|
|
||
|
/* renamed from: o.jUY, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes.dex */
|
||
|
final class C15899jUY {
|
||
|
private String a;
|
||
|
int c;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public C15899jUY(byte b) throws NoSuchAlgorithmException {
|
||
|
switch (b) {
|
||
|
case 18:
|
||
|
this.a = McElieceCCA2KeyGenParameterSpec.SHA1;
|
||
|
this.c = a(McElieceCCA2KeyGenParameterSpec.SHA1);
|
||
|
return;
|
||
|
case 19:
|
||
|
this.a = McElieceCCA2KeyGenParameterSpec.SHA224;
|
||
|
this.c = a(McElieceCCA2KeyGenParameterSpec.SHA224);
|
||
|
return;
|
||
|
case 20:
|
||
|
this.a = McElieceCCA2KeyGenParameterSpec.SHA256;
|
||
|
this.c = a(McElieceCCA2KeyGenParameterSpec.SHA256);
|
||
|
return;
|
||
|
case 21:
|
||
|
this.a = McElieceCCA2KeyGenParameterSpec.SHA384;
|
||
|
this.c = a(McElieceCCA2KeyGenParameterSpec.SHA384);
|
||
|
return;
|
||
|
case 22:
|
||
|
this.a = McElieceCCA2KeyGenParameterSpec.SHA512;
|
||
|
this.c = a(McElieceCCA2KeyGenParameterSpec.SHA512);
|
||
|
return;
|
||
|
default:
|
||
|
StringBuilder sb = new StringBuilder("AlgoID=0x");
|
||
|
sb.append(Integer.toHexString(b));
|
||
|
throw new NoSuchAlgorithmException(sb.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final byte[] b(byte[] bArr, int i) {
|
||
|
byte[] bArr2 = new byte[i];
|
||
|
System.arraycopy(bArr, 0, bArr2, 0, i);
|
||
|
try {
|
||
|
MessageDigest messageDigest = MessageDigest.getInstance(this.a);
|
||
|
messageDigest.update(bArr2);
|
||
|
return messageDigest.digest();
|
||
|
} catch (java.security.NoSuchAlgorithmException e) {
|
||
|
StringBuilder sb = new StringBuilder("No such algorithm: ");
|
||
|
sb.append(this.a);
|
||
|
throw new IllegalArgumentException(sb.toString(), e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static int a(String str) {
|
||
|
try {
|
||
|
return MessageDigest.getInstance(str).getDigestLength();
|
||
|
} catch (java.security.NoSuchAlgorithmException e) {
|
||
|
throw new IllegalArgumentException("No such algorithm: ".concat(String.valueOf(str)), e);
|
||
|
}
|
||
|
}
|
||
|
}
|