34 lines
1.5 KiB
Java
34 lines
1.5 KiB
Java
|
package o;
|
||
|
|
||
|
import java.security.GeneralSecurityException;
|
||
|
import java.security.InvalidAlgorithmParameterException;
|
||
|
import java.util.Locale;
|
||
|
import java.util.regex.Pattern;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class ifG {
|
||
|
public static void e(int i) throws InvalidAlgorithmParameterException {
|
||
|
if (i != 16 && i != 32) {
|
||
|
throw new InvalidAlgorithmParameterException(String.format("invalid key size %d; only 128-bit and 256-bit AES keys are supported", Integer.valueOf(i << 3)));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static void b(int i) throws GeneralSecurityException {
|
||
|
if (i < 0 || i > 0) {
|
||
|
throw new GeneralSecurityException(String.format("key has version %d; only keys with version in range [0..%d] are supported", Integer.valueOf(i), 0));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static String c(String str, String str2) {
|
||
|
if (!str2.toLowerCase(Locale.US).startsWith(str)) {
|
||
|
throw new IllegalArgumentException(String.format("key URI must start with %s", str));
|
||
|
}
|
||
|
return str2.substring(str.length());
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
Pattern.compile(String.format("^projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s$", "([0-9a-zA-Z\\-\\.\\_~])+", "([0-9a-zA-Z\\-\\.\\_~])+", "([0-9a-zA-Z\\-\\.\\_~])+", "([0-9a-zA-Z\\-\\.\\_~])+"), 2);
|
||
|
Pattern.compile(String.format("^projects/%s/locations/%s/keyRings/%s/cryptoKeys/%s/cryptoKeyVersions/%s$", "([0-9a-zA-Z\\-\\.\\_~])+", "([0-9a-zA-Z\\-\\.\\_~])+", "([0-9a-zA-Z\\-\\.\\_~])+", "([0-9a-zA-Z\\-\\.\\_~])+", "([0-9a-zA-Z\\-\\.\\_~])+"), 2);
|
||
|
}
|
||
|
}
|