Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9
以下内容为反编译后的 Keys.java 源代码,内容仅作参考
package io.jsonwebtoken.security;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.lang.Assert;
import io.jsonwebtoken.lang.Classes;
import java.security.KeyPair;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import myobfuscated.b02.b;
public final class Keys {
private static final String EC = "io.jsonwebtoken.impl.crypto.EllipticCurveProvider";
private static final String MAC = "io.jsonwebtoken.impl.crypto.MacProvider";
private static final String RSA = "io.jsonwebtoken.impl.crypto.RsaProvider";
private static final Class[] SIG_ARG_TYPES = {SignatureAlgorithm.class};
private static final List<SignatureAlgorithm> PREFERRED_HMAC_ALGS = Collections.unmodifiableList(Arrays.asList(SignatureAlgorithm.HS512, SignatureAlgorithm.HS384, SignatureAlgorithm.HS256));
public static class AnonymousClass1 {
static final int[] $SwitchMap$io$jsonwebtoken$SignatureAlgorithm;
static {
int[] iArr = new int[SignatureAlgorithm.values().length];
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm = iArr;
try {
iArr[SignatureAlgorithm.HS256.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.HS384.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.HS512.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.RS256.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.PS256.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.RS384.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.PS384.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.RS512.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.PS512.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.ES256.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.ES384.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[SignatureAlgorithm.ES512.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
}
}
private Keys() {
}
public static SecretKey hmacShaKeyFor(byte[] bArr) throws WeakKeyException {
if (bArr != null) {
int length = bArr.length * 8;
for (SignatureAlgorithm signatureAlgorithm : PREFERRED_HMAC_ALGS) {
if (length >= signatureAlgorithm.getMinKeyLength()) {
return new SecretKeySpec(bArr, signatureAlgorithm.getJcaName());
}
}
StringBuilder p = b.p("The specified key byte array is ", length, " bits which is not secure enough for any JWT HMAC-SHA algorithm. The JWT JWA Specification (RFC 7518, Section 3.2) states that keys used with HMAC-SHA algorithms MUST have a size >= 256 bits (the key size must be greater than or equal to the hash output size). Consider using the ");
p.append(Keys.class.getName());
p.append("#secretKeyFor(SignatureAlgorithm) method to create a key guaranteed to be secure enough for your preferred HMAC-SHA algorithm. See https://tools.ietf.org/html/rfc7518#section-3.2 for more information.");
throw new WeakKeyException(p.toString());
}
throw new InvalidKeyException("SecretKey byte array cannot be null.");
}
public static KeyPair keyPairFor(SignatureAlgorithm signatureAlgorithm) throws IllegalArgumentException {
Assert.notNull(signatureAlgorithm, "SignatureAlgorithm cannot be null.");
switch (AnonymousClass1.$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[signatureAlgorithm.ordinal()]) {
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
return (KeyPair) Classes.invokeStatic(RSA, "generateKeyPair", SIG_ARG_TYPES, signatureAlgorithm);
case 10:
case 11:
case 12:
return (KeyPair) Classes.invokeStatic(EC, "generateKeyPair", SIG_ARG_TYPES, signatureAlgorithm);
default:
throw new IllegalArgumentException("The " + signatureAlgorithm.name() + " algorithm does not support Key Pairs.");
}
}
public static SecretKey secretKeyFor(SignatureAlgorithm signatureAlgorithm) throws IllegalArgumentException {
Assert.notNull(signatureAlgorithm, "SignatureAlgorithm cannot be null.");
int i = AnonymousClass1.$SwitchMap$io$jsonwebtoken$SignatureAlgorithm[signatureAlgorithm.ordinal()];
if (i == 1 || i == 2 || i == 3) {
return (SecretKey) Classes.invokeStatic(MAC, "generateKey", SIG_ARG_TYPES, signatureAlgorithm);
}
throw new IllegalArgumentException("The " + signatureAlgorithm.name() + " algorithm does not support shared secret keys.");
}
}