163 lines
6.3 KiB
Java
163 lines
6.3 KiB
Java
|
package org.bouncycastle.jcajce.provider.symmetric;
|
||
|
|
||
|
import java.security.AlgorithmParameters;
|
||
|
import java.security.InvalidAlgorithmParameterException;
|
||
|
import java.security.SecureRandom;
|
||
|
import java.security.spec.AlgorithmParameterSpec;
|
||
|
import javax.crypto.spec.IvParameterSpec;
|
||
|
import org.bouncycastle.crypto.BlockCipher;
|
||
|
import org.bouncycastle.crypto.BufferedBlockCipher;
|
||
|
import org.bouncycastle.crypto.CipherKeyGenerator;
|
||
|
import org.bouncycastle.crypto.engines.RC6Engine;
|
||
|
import org.bouncycastle.crypto.generators.Poly1305KeyGenerator;
|
||
|
import org.bouncycastle.crypto.macs.GMac;
|
||
|
import org.bouncycastle.crypto.modes.CBCBlockCipher;
|
||
|
import org.bouncycastle.crypto.modes.CFBBlockCipher;
|
||
|
import org.bouncycastle.crypto.modes.GCMBlockCipher;
|
||
|
import org.bouncycastle.crypto.modes.OFBBlockCipher;
|
||
|
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
|
||
|
import org.bouncycastle.jcajce.provider.symmetric.util.BaseAlgorithmParameterGenerator;
|
||
|
import org.bouncycastle.jcajce.provider.symmetric.util.BaseBlockCipher;
|
||
|
import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator;
|
||
|
import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac;
|
||
|
import org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider;
|
||
|
import org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class RC6 {
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class AlgParamGen extends BaseAlgorithmParameterGenerator {
|
||
|
@Override // java.security.AlgorithmParameterGeneratorSpi
|
||
|
protected void engineInit(AlgorithmParameterSpec algorithmParameterSpec, SecureRandom secureRandom) throws InvalidAlgorithmParameterException {
|
||
|
throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for RC6 parameter generation.");
|
||
|
}
|
||
|
|
||
|
@Override // java.security.AlgorithmParameterGeneratorSpi
|
||
|
protected AlgorithmParameters engineGenerateParameters() {
|
||
|
byte[] bArr = new byte[16];
|
||
|
if (this.random == null) {
|
||
|
this.random = new SecureRandom();
|
||
|
}
|
||
|
this.random.nextBytes(bArr);
|
||
|
try {
|
||
|
AlgorithmParameters createParametersInstance = createParametersInstance("RC6");
|
||
|
createParametersInstance.init(new IvParameterSpec(bArr));
|
||
|
return createParametersInstance;
|
||
|
} catch (Exception e) {
|
||
|
throw new RuntimeException(e.getMessage());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class Mappings extends SymmetricAlgorithmProvider {
|
||
|
private static final String PREFIX = RC6.class.getName();
|
||
|
|
||
|
@Override // org.bouncycastle.jcajce.provider.util.AlgorithmProvider
|
||
|
public void configure(ConfigurableProvider configurableProvider) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
String str = PREFIX;
|
||
|
sb.append(str);
|
||
|
sb.append("$ECB");
|
||
|
configurableProvider.addAlgorithm("Cipher.RC6", sb.toString());
|
||
|
StringBuilder sb2 = new StringBuilder();
|
||
|
sb2.append(str);
|
||
|
sb2.append("$KeyGen");
|
||
|
configurableProvider.addAlgorithm("KeyGenerator.RC6", sb2.toString());
|
||
|
StringBuilder sb3 = new StringBuilder();
|
||
|
sb3.append(str);
|
||
|
sb3.append("$AlgParams");
|
||
|
configurableProvider.addAlgorithm("AlgorithmParameters.RC6", sb3.toString());
|
||
|
StringBuilder sb4 = new StringBuilder();
|
||
|
sb4.append(str);
|
||
|
sb4.append("$GMAC");
|
||
|
String obj = sb4.toString();
|
||
|
StringBuilder sb5 = new StringBuilder();
|
||
|
sb5.append(str);
|
||
|
sb5.append("$KeyGen");
|
||
|
addGMacAlgorithm(configurableProvider, "RC6", obj, sb5.toString());
|
||
|
StringBuilder sb6 = new StringBuilder();
|
||
|
sb6.append(str);
|
||
|
sb6.append("$Poly1305");
|
||
|
String obj2 = sb6.toString();
|
||
|
StringBuilder sb7 = new StringBuilder();
|
||
|
sb7.append(str);
|
||
|
sb7.append("$Poly1305KeyGen");
|
||
|
addPoly1305Algorithm(configurableProvider, "RC6", obj2, sb7.toString());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class AlgParams extends IvAlgorithmParameters {
|
||
|
@Override // org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters, java.security.AlgorithmParametersSpi
|
||
|
public String engineToString() {
|
||
|
return "RC6 IV";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class CBC extends BaseBlockCipher {
|
||
|
public CBC() {
|
||
|
super(new CBCBlockCipher(new RC6Engine()), 128);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class CFB extends BaseBlockCipher {
|
||
|
public CFB() {
|
||
|
super(new BufferedBlockCipher(new CFBBlockCipher(new RC6Engine(), 128)), 128);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class ECB extends BaseBlockCipher {
|
||
|
public ECB() {
|
||
|
super(new BlockCipherProvider() { // from class: org.bouncycastle.jcajce.provider.symmetric.RC6.ECB.1
|
||
|
@Override // org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider
|
||
|
public BlockCipher get() {
|
||
|
return new RC6Engine();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class GMAC extends BaseMac {
|
||
|
public GMAC() {
|
||
|
super(new GMac(new GCMBlockCipher(new RC6Engine())));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class KeyGen extends BaseKeyGenerator {
|
||
|
public KeyGen() {
|
||
|
super("RC6", 256, new CipherKeyGenerator());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class OFB extends BaseBlockCipher {
|
||
|
public OFB() {
|
||
|
super(new BufferedBlockCipher(new OFBBlockCipher(new RC6Engine(), 128)), 128);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class Poly1305 extends BaseMac {
|
||
|
public Poly1305() {
|
||
|
super(new org.bouncycastle.crypto.macs.Poly1305(new RC6Engine()));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public static class Poly1305KeyGen extends BaseKeyGenerator {
|
||
|
public Poly1305KeyGen() {
|
||
|
super("Poly1305-RC6", 256, new Poly1305KeyGenerator());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private RC6() {
|
||
|
}
|
||
|
}
|