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

251 lines
11 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.jcajce.provider.symmetric;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.gnu.GNUObjectIdentifiers;
import org.bouncycastle.crypto.BlockCipher;
import org.bouncycastle.crypto.BufferedBlockCipher;
import org.bouncycastle.crypto.CipherKeyGenerator;
import org.bouncycastle.crypto.engines.SerpentEngine;
import org.bouncycastle.crypto.engines.TnepresEngine;
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.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.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 Serpent {
/* loaded from: classes6.dex */
public static class Mappings extends SymmetricAlgorithmProvider {
private static final String PREFIX = Serpent.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.Serpent", sb.toString());
StringBuilder sb2 = new StringBuilder();
sb2.append(str);
sb2.append("$KeyGen");
configurableProvider.addAlgorithm("KeyGenerator.Serpent", sb2.toString());
StringBuilder sb3 = new StringBuilder();
sb3.append(str);
sb3.append("$AlgParams");
configurableProvider.addAlgorithm("AlgorithmParameters.Serpent", sb3.toString());
StringBuilder sb4 = new StringBuilder();
sb4.append(str);
sb4.append("$TECB");
configurableProvider.addAlgorithm("Cipher.Tnepres", sb4.toString());
StringBuilder sb5 = new StringBuilder();
sb5.append(str);
sb5.append("$TKeyGen");
configurableProvider.addAlgorithm("KeyGenerator.Tnepres", sb5.toString());
StringBuilder sb6 = new StringBuilder();
sb6.append(str);
sb6.append("$TAlgParams");
configurableProvider.addAlgorithm("AlgorithmParameters.Tnepres", sb6.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier = GNUObjectIdentifiers.Serpent_128_ECB;
StringBuilder sb7 = new StringBuilder();
sb7.append(str);
sb7.append("$ECB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier, sb7.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier2 = GNUObjectIdentifiers.Serpent_192_ECB;
StringBuilder sb8 = new StringBuilder();
sb8.append(str);
sb8.append("$ECB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier2, sb8.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier3 = GNUObjectIdentifiers.Serpent_256_ECB;
StringBuilder sb9 = new StringBuilder();
sb9.append(str);
sb9.append("$ECB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier3, sb9.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier4 = GNUObjectIdentifiers.Serpent_128_CBC;
StringBuilder sb10 = new StringBuilder();
sb10.append(str);
sb10.append("$CBC");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier4, sb10.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier5 = GNUObjectIdentifiers.Serpent_192_CBC;
StringBuilder sb11 = new StringBuilder();
sb11.append(str);
sb11.append("$CBC");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier5, sb11.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier6 = GNUObjectIdentifiers.Serpent_256_CBC;
StringBuilder sb12 = new StringBuilder();
sb12.append(str);
sb12.append("$CBC");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier6, sb12.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier7 = GNUObjectIdentifiers.Serpent_128_CFB;
StringBuilder sb13 = new StringBuilder();
sb13.append(str);
sb13.append("$CFB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier7, sb13.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier8 = GNUObjectIdentifiers.Serpent_192_CFB;
StringBuilder sb14 = new StringBuilder();
sb14.append(str);
sb14.append("$CFB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier8, sb14.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier9 = GNUObjectIdentifiers.Serpent_256_CFB;
StringBuilder sb15 = new StringBuilder();
sb15.append(str);
sb15.append("$CFB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier9, sb15.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier10 = GNUObjectIdentifiers.Serpent_128_OFB;
StringBuilder sb16 = new StringBuilder();
sb16.append(str);
sb16.append("$OFB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier10, sb16.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier11 = GNUObjectIdentifiers.Serpent_192_OFB;
StringBuilder sb17 = new StringBuilder();
sb17.append(str);
sb17.append("$OFB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier11, sb17.toString());
ASN1ObjectIdentifier aSN1ObjectIdentifier12 = GNUObjectIdentifiers.Serpent_256_OFB;
StringBuilder sb18 = new StringBuilder();
sb18.append(str);
sb18.append("$OFB");
configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier12, sb18.toString());
StringBuilder sb19 = new StringBuilder();
sb19.append(str);
sb19.append("$SerpentGMAC");
String obj = sb19.toString();
StringBuilder sb20 = new StringBuilder();
sb20.append(str);
sb20.append("$KeyGen");
addGMacAlgorithm(configurableProvider, "SERPENT", obj, sb20.toString());
StringBuilder sb21 = new StringBuilder();
sb21.append(str);
sb21.append("$TSerpentGMAC");
String obj2 = sb21.toString();
StringBuilder sb22 = new StringBuilder();
sb22.append(str);
sb22.append("$TKeyGen");
addGMacAlgorithm(configurableProvider, "TNEPRES", obj2, sb22.toString());
StringBuilder sb23 = new StringBuilder();
sb23.append(str);
sb23.append("$Poly1305");
String obj3 = sb23.toString();
StringBuilder sb24 = new StringBuilder();
sb24.append(str);
sb24.append("$Poly1305KeyGen");
addPoly1305Algorithm(configurableProvider, "SERPENT", obj3, sb24.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 "Serpent IV";
}
}
/* loaded from: classes6.dex */
public static class TAlgParams extends IvAlgorithmParameters {
@Override // org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters, java.security.AlgorithmParametersSpi
public String engineToString() {
return "Tnepres IV";
}
}
/* loaded from: classes6.dex */
public static class CBC extends BaseBlockCipher {
public CBC() {
super(new CBCBlockCipher(new SerpentEngine()), 128);
}
}
/* loaded from: classes6.dex */
public static class CFB extends BaseBlockCipher {
public CFB() {
super(new BufferedBlockCipher(new CFBBlockCipher(new SerpentEngine(), 128)), 128);
}
}
/* loaded from: classes6.dex */
public static class ECB extends BaseBlockCipher {
public ECB() {
super(new BlockCipherProvider() { // from class: org.bouncycastle.jcajce.provider.symmetric.Serpent.ECB.1
@Override // org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider
public BlockCipher get() {
return new SerpentEngine();
}
});
}
}
/* loaded from: classes6.dex */
public static class KeyGen extends BaseKeyGenerator {
public KeyGen() {
super("Serpent", 192, new CipherKeyGenerator());
}
}
/* loaded from: classes6.dex */
public static class OFB extends BaseBlockCipher {
public OFB() {
super(new BufferedBlockCipher(new OFBBlockCipher(new SerpentEngine(), 128)), 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-Serpent", 256, new Poly1305KeyGenerator());
}
}
/* loaded from: classes6.dex */
public static class SerpentGMAC extends BaseMac {
public SerpentGMAC() {
super(new GMac(new GCMBlockCipher(new SerpentEngine())));
}
}
/* loaded from: classes6.dex */
public static class TECB extends BaseBlockCipher {
public TECB() {
super(new BlockCipherProvider() { // from class: org.bouncycastle.jcajce.provider.symmetric.Serpent.TECB.1
@Override // org.bouncycastle.jcajce.provider.symmetric.util.BlockCipherProvider
public BlockCipher get() {
return new TnepresEngine();
}
});
}
}
/* loaded from: classes6.dex */
public static class TKeyGen extends BaseKeyGenerator {
public TKeyGen() {
super("Tnepres", 192, new CipherKeyGenerator());
}
}
/* loaded from: classes6.dex */
public static class TSerpentGMAC extends BaseMac {
public TSerpentGMAC() {
super(new GMac(new GCMBlockCipher(new TnepresEngine())));
}
}
private Serpent() {
}
}