package org.bouncycastle.jcajce.util; import java.io.IOException; import java.security.AlgorithmParameters; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1Primitive; /* loaded from: classes6.dex */ public class AlgorithmParametersUtils { public static void loadParameters(AlgorithmParameters algorithmParameters, ASN1Encodable aSN1Encodable) throws IOException { try { algorithmParameters.init(aSN1Encodable.toASN1Primitive().getEncoded(), "ASN.1"); } catch (Exception unused) { algorithmParameters.init(aSN1Encodable.toASN1Primitive().getEncoded()); } } public static ASN1Encodable extractParameters(AlgorithmParameters algorithmParameters) throws IOException { try { return ASN1Primitive.fromByteArray(algorithmParameters.getEncoded("ASN.1")); } catch (Exception unused) { return ASN1Primitive.fromByteArray(algorithmParameters.getEncoded()); } } private AlgorithmParametersUtils() { } }