what-the-bank/sources/org/bouncycastle/jcajce/provider/digest/SHA1.java

111 lines
4.7 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.jcajce.provider.digest;
import org.bouncycastle.asn1.iana.IANAObjectIdentifiers;
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.crypto.CipherKeyGenerator;
import org.bouncycastle.crypto.digests.SHA1Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.jcajce.provider.config.ConfigurableProvider;
import org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator;
import org.bouncycastle.jcajce.provider.symmetric.util.BaseMac;
import org.bouncycastle.jcajce.provider.symmetric.util.PBESecretKeyFactory;
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
/* loaded from: classes6.dex */
public class SHA1 {
/* loaded from: classes6.dex */
public static class Mappings extends DigestAlgorithmProvider {
private static final String PREFIX = SHA1.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("$Digest");
configurableProvider.addAlgorithm("MessageDigest.SHA-1", sb.toString());
configurableProvider.addAlgorithm("Alg.Alias.MessageDigest.SHA1", McElieceCCA2KeyGenParameterSpec.SHA1);
configurableProvider.addAlgorithm("Alg.Alias.MessageDigest.SHA", McElieceCCA2KeyGenParameterSpec.SHA1);
StringBuilder sb2 = new StringBuilder("Alg.Alias.MessageDigest.");
sb2.append(OIWObjectIdentifiers.idSHA1);
configurableProvider.addAlgorithm(sb2.toString(), McElieceCCA2KeyGenParameterSpec.SHA1);
StringBuilder sb3 = new StringBuilder();
sb3.append(str);
sb3.append("$HashMac");
String obj = sb3.toString();
StringBuilder sb4 = new StringBuilder();
sb4.append(str);
sb4.append("$KeyGenerator");
addHMACAlgorithm(configurableProvider, "SHA1", obj, sb4.toString());
addHMACAlias(configurableProvider, "SHA1", PKCSObjectIdentifiers.id_hmacWithSHA1);
addHMACAlias(configurableProvider, "SHA1", IANAObjectIdentifiers.hmacSHA1);
StringBuilder sb5 = new StringBuilder();
sb5.append(str);
sb5.append("$SHA1Mac");
configurableProvider.addAlgorithm("Mac.PBEWITHHMACSHA", sb5.toString());
StringBuilder sb6 = new StringBuilder();
sb6.append(str);
sb6.append("$SHA1Mac");
configurableProvider.addAlgorithm("Mac.PBEWITHHMACSHA1", sb6.toString());
configurableProvider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA", "PBEWITHHMACSHA1");
StringBuilder sb7 = new StringBuilder("Alg.Alias.SecretKeyFactory.");
sb7.append(OIWObjectIdentifiers.idSHA1);
configurableProvider.addAlgorithm(sb7.toString(), "PBEWITHHMACSHA1");
StringBuilder sb8 = new StringBuilder("Alg.Alias.Mac.");
sb8.append(OIWObjectIdentifiers.idSHA1);
configurableProvider.addAlgorithm(sb8.toString(), "PBEWITHHMACSHA");
StringBuilder sb9 = new StringBuilder();
sb9.append(str);
sb9.append("$PBEWithMacKeyFactory");
configurableProvider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA1", sb9.toString());
}
}
/* loaded from: classes6.dex */
public static class Digest extends BCMessageDigest implements Cloneable {
@Override // java.security.MessageDigest, java.security.MessageDigestSpi
public Object clone() throws CloneNotSupportedException {
Digest digest = (Digest) super.clone();
digest.digest = new SHA1Digest((SHA1Digest) this.digest);
return digest;
}
public Digest() {
super(new SHA1Digest());
}
}
/* loaded from: classes6.dex */
public static class HashMac extends BaseMac {
public HashMac() {
super(new HMac(new SHA1Digest()));
}
}
/* loaded from: classes6.dex */
public static class KeyGenerator extends BaseKeyGenerator {
public KeyGenerator() {
super("HMACSHA1", 160, new CipherKeyGenerator());
}
}
/* loaded from: classes6.dex */
public static class PBEWithMacKeyFactory extends PBESecretKeyFactory {
public PBEWithMacKeyFactory() {
super("PBEwithHmacSHA", null, false, 2, 1, 160, 0);
}
}
/* loaded from: classes6.dex */
public static class SHA1Mac extends BaseMac {
public SHA1Mac() {
super(new HMac(new SHA1Digest()));
}
}
private SHA1() {
}
}