/MATE-20_EMUI_11.0.0/src/main/java/org/bouncycastle/jcajce/provider/symmetric/Blowfish.java
https://github.com/dstmath/HWFramework · Java · 68 lines · 57 code · 10 blank · 1 comment · 0 complexity · 22fe666414666bd000f4752155493bcb MD5 · raw file
- package org.bouncycastle.jcajce.provider.symmetric;
- import org.bouncycastle.asn1.ASN1ObjectIdentifier;
- import org.bouncycastle.asn1.misc.MiscObjectIdentifiers;
- import org.bouncycastle.crypto.CipherKeyGenerator;
- import org.bouncycastle.crypto.engines.BlowfishEngine;
- import org.bouncycastle.crypto.macs.CMac;
- import org.bouncycastle.crypto.modes.CBCBlockCipher;
- 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.IvAlgorithmParameters;
- import org.bouncycastle.jcajce.provider.util.AlgorithmProvider;
- public final class Blowfish {
- public static class AlgParams extends IvAlgorithmParameters {
- /* access modifiers changed from: protected */
- @Override // org.bouncycastle.jcajce.provider.symmetric.util.IvAlgorithmParameters, java.security.AlgorithmParametersSpi
- public String engineToString() {
- return "Blowfish IV";
- }
- }
- public static class CBC extends BaseBlockCipher {
- public CBC() {
- super(new CBCBlockCipher(new BlowfishEngine()), 64);
- }
- }
- public static class CMAC extends BaseMac {
- public CMAC() {
- super(new CMac(new BlowfishEngine()));
- }
- }
- public static class ECB extends BaseBlockCipher {
- public ECB() {
- super(new BlowfishEngine());
- }
- }
- public static class KeyGen extends BaseKeyGenerator {
- public KeyGen() {
- super("Blowfish", 128, new CipherKeyGenerator());
- }
- }
- public static class Mappings extends AlgorithmProvider {
- private static final String PREFIX = Blowfish.class.getName();
- @Override // org.bouncycastle.jcajce.provider.util.AlgorithmProvider
- public void configure(ConfigurableProvider configurableProvider) {
- configurableProvider.addAlgorithm("Mac.BLOWFISHCMAC", PREFIX + "$CMAC");
- configurableProvider.addAlgorithm("Cipher.BLOWFISH", PREFIX + "$ECB");
- ASN1ObjectIdentifier aSN1ObjectIdentifier = MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC;
- configurableProvider.addAlgorithm("Cipher", aSN1ObjectIdentifier, PREFIX + "$CBC");
- configurableProvider.addAlgorithm("KeyGenerator.BLOWFISH", PREFIX + "$KeyGen");
- configurableProvider.addAlgorithm("Alg.Alias.KeyGenerator", MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC, "BLOWFISH");
- configurableProvider.addAlgorithm("AlgorithmParameters.BLOWFISH", PREFIX + "$AlgParams");
- configurableProvider.addAlgorithm("Alg.Alias.AlgorithmParameters", MiscObjectIdentifiers.cryptlib_algorithm_blowfish_CBC, "BLOWFISH");
- }
- }
- private Blowfish() {
- }
- }