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

91 lines
3.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.jcajce.provider.digest;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.crypto.CipherKeyGenerator;
import org.bouncycastle.crypto.digests.SHA256Digest;
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 SHA256 {
/* loaded from: classes6.dex */
public static class Mappings extends DigestAlgorithmProvider {
private static final String PREFIX = SHA256.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-256", sb.toString());
configurableProvider.addAlgorithm("Alg.Alias.MessageDigest.SHA256", McElieceCCA2KeyGenParameterSpec.SHA256);
StringBuilder sb2 = new StringBuilder("Alg.Alias.MessageDigest.");
sb2.append(NISTObjectIdentifiers.id_sha256);
configurableProvider.addAlgorithm(sb2.toString(), McElieceCCA2KeyGenParameterSpec.SHA256);
StringBuilder sb3 = new StringBuilder();
sb3.append(str);
sb3.append("$PBEWithMacKeyFactory");
configurableProvider.addAlgorithm("SecretKeyFactory.PBEWITHHMACSHA256", sb3.toString());
configurableProvider.addAlgorithm("Alg.Alias.SecretKeyFactory.PBEWITHHMACSHA-256", "PBEWITHHMACSHA256");
StringBuilder sb4 = new StringBuilder("Alg.Alias.SecretKeyFactory.");
sb4.append(NISTObjectIdentifiers.id_sha256);
configurableProvider.addAlgorithm(sb4.toString(), "PBEWITHHMACSHA256");
StringBuilder sb5 = new StringBuilder();
sb5.append(str);
sb5.append("$HashMac");
String obj = sb5.toString();
StringBuilder sb6 = new StringBuilder();
sb6.append(str);
sb6.append("$KeyGenerator");
addHMACAlgorithm(configurableProvider, "SHA256", obj, sb6.toString());
addHMACAlias(configurableProvider, "SHA256", PKCSObjectIdentifiers.id_hmacWithSHA256);
addHMACAlias(configurableProvider, "SHA256", NISTObjectIdentifiers.id_sha256);
}
}
/* 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 SHA256Digest((SHA256Digest) this.digest);
return digest;
}
public Digest() {
super(new SHA256Digest());
}
}
/* loaded from: classes6.dex */
public static class HashMac extends BaseMac {
public HashMac() {
super(new HMac(new SHA256Digest()));
}
}
/* loaded from: classes6.dex */
public static class KeyGenerator extends BaseKeyGenerator {
public KeyGenerator() {
super("HMACSHA256", 256, new CipherKeyGenerator());
}
}
/* loaded from: classes6.dex */
public static class PBEWithMacKeyFactory extends PBESecretKeyFactory {
public PBEWithMacKeyFactory() {
super("PBEwithHmacSHA256", null, false, 2, 4, 256, 0);
}
}
private SHA256() {
}
}