what-the-bank/sources/org/bouncycastle/jcajce/provider/symmetric/Twofish.java

134 lines
5.4 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.jcajce.provider.symmetric;
import org.bouncycastle.crypto.BlockCipher;
import org.bouncycastle.crypto.CipherKeyGenerator;
import org.bouncycastle.crypto.engines.TwofishEngine;
import org.bouncycastle.crypto.generators.Poly1305KeyGenerator;
import org.bouncycastle.crypto.macs.GMac;
import org.bouncycastle.crypto.modes.CBCBlockCipher;
import org.bouncycastle.crypto.modes.GCMBlockCipher;
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
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;
import org.bouncycastle.jcajce.provider.symmetric.util.PBESecretKeyFactory;
/* loaded from: classes6.dex */
public final class Twofish {
/* loaded from: classes6.dex */
public static class Mappings extends SymmetricAlgorithmProvider {
private static final String PREFIX = Twofish.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.Twofish", sb.toString());
StringBuilder sb2 = new StringBuilder();
sb2.append(str);
sb2.append("$KeyGen");
configurableProvider.addAlgorithm("KeyGenerator.Twofish", sb2.toString());
StringBuilder sb3 = new StringBuilder();
sb3.append(str);
sb3.append("$AlgParams");
configurableProvider.addAlgorithm("AlgorithmParameters.Twofish", sb3.toString());
configurableProvider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH", "PKCS12PBE");
configurableProvider.addAlgorithm("Alg.Alias.AlgorithmParameters.PBEWITHSHAANDTWOFISH-CBC", "PKCS12PBE");
StringBuilder sb4 = new StringBuilder();
sb4.append(str);
sb4.append("$PBEWithSHA");
configurableProvider.addAlgorithm("Cipher.PBEWITHSHAANDTWOFISH-CBC", sb4.toString());
StringBuilder sb5 = new StringBuilder();
sb5.append(str);
sb5.append("$PBEWithSHAKeyFactory");
configurableProvider.addAlgorithm("SecretKeyFactory.PBEWITHSHAANDTWOFISH-CBC", sb5.toString());
StringBuilder sb6 = new StringBuilder();
sb6.append(str);
sb6.append("$GMAC");
String obj = sb6.toString();
StringBuilder sb7 = new StringBuilder();
sb7.append(str);
sb7.append("$KeyGen");
addGMacAlgorithm(configurableProvider, "Twofish", obj, sb7.toString());
StringBuilder sb8 = new StringBuilder();
sb8.append(str);
sb8.append("$Poly1305");
String obj2 = sb8.toString();
StringBuilder sb9 = new StringBuilder();
sb9.append(str);
sb9.append("$Poly1305KeyGen");
addPoly1305Algorithm(configurableProvider, "Twofish", obj2, sb9.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 "Twofish IV";
}
}
/* loaded from: classes6.dex */
public static class ECB extends BaseBlockCipher {
public ECB() {
super(new BlockCipherProvider() { // from class: org.bouncycastle.jcajce.provider.symmetric.Twofish.ECB.1
@Override // org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider
public BlockCipher get() {
return new TwofishEngine();
}
});
}
}
/* loaded from: classes6.dex */
public static class GMAC extends BaseMac {
public GMAC() {
super(new GMac(new GCMBlockCipher(new TwofishEngine())));
}
}
/* loaded from: classes6.dex */
public static class KeyGen extends BaseKeyGenerator {
public KeyGen() {
super("Twofish", 256, new CipherKeyGenerator());
}
}
/* loaded from: classes6.dex */
public static class PBEWithSHA extends BaseBlockCipher {
public PBEWithSHA() {
super(new CBCBlockCipher(new TwofishEngine()), 2, 1, 256, 16);
}
}
/* loaded from: classes6.dex */
public static class PBEWithSHAKeyFactory extends PBESecretKeyFactory {
public PBEWithSHAKeyFactory() {
super("PBEwithSHAandTwofish-CBC", null, true, 2, 1, 256, 128);
}
}
/* loaded from: classes6.dex */
public static class Poly1305 extends BaseMac {
public Poly1305() {
super(new org.bouncycastle.crypto.macs.Poly1305(new TwofishEngine()));
}
}
/* loaded from: classes6.dex */
public static class Poly1305KeyGen extends BaseKeyGenerator {
public Poly1305KeyGen() {
super("Poly1305-Twofish", 256, new Poly1305KeyGenerator());
}
}
private Twofish() {
}
}