package org.bouncycastle.pqc.jcajce.provider.mceliece; import org.bouncycastle.asn1.DERNull; import org.bouncycastle.asn1.nist.NISTObjectIdentifiers; import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.crypto.Digest; import org.bouncycastle.crypto.digests.SHA1Digest; import org.bouncycastle.crypto.digests.SHA224Digest; import org.bouncycastle.crypto.digests.SHA256Digest; import org.bouncycastle.crypto.digests.SHA384Digest; import org.bouncycastle.crypto.digests.SHA512Digest; import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec; /* loaded from: classes6.dex */ class Utils { /* JADX INFO: Access modifiers changed from: package-private */ public static Digest getDigest(AlgorithmIdentifier algorithmIdentifier) { if (algorithmIdentifier.getAlgorithm().equals(OIWObjectIdentifiers.idSHA1)) { return new SHA1Digest(); } if (algorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha224)) { return new SHA224Digest(); } if (algorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha256)) { return new SHA256Digest(); } if (algorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha384)) { return new SHA384Digest(); } if (algorithmIdentifier.getAlgorithm().equals(NISTObjectIdentifiers.id_sha512)) { return new SHA512Digest(); } StringBuilder sb = new StringBuilder("unrecognised OID in digest algorithm identifier: "); sb.append(algorithmIdentifier.getAlgorithm()); throw new IllegalArgumentException(sb.toString()); } /* JADX INFO: Access modifiers changed from: package-private */ public static AlgorithmIdentifier getDigAlgId(String str) { if (str.equals(McElieceCCA2KeyGenParameterSpec.SHA1)) { return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1, DERNull.INSTANCE); } if (str.equals(McElieceCCA2KeyGenParameterSpec.SHA224)) { return new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha224, DERNull.INSTANCE); } if (str.equals(McElieceCCA2KeyGenParameterSpec.SHA256)) { return new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256, DERNull.INSTANCE); } if (str.equals(McElieceCCA2KeyGenParameterSpec.SHA384)) { return new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha384, DERNull.INSTANCE); } if (str.equals(McElieceCCA2KeyGenParameterSpec.SHA512)) { return new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha512, DERNull.INSTANCE); } throw new IllegalArgumentException("unrecognised digest algorithm: ".concat(String.valueOf(str))); } Utils() { } }