package org.bouncycastle.crypto.util; import java.io.IOException; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; import org.bouncycastle.asn1.DEROctetString; import org.bouncycastle.util.Arrays; /* loaded from: classes6.dex */ class DerUtil { /* JADX INFO: Access modifiers changed from: package-private */ public static byte[] toByteArray(ASN1Primitive aSN1Primitive) { try { return aSN1Primitive.getEncoded(); } catch (IOException e) { StringBuilder sb = new StringBuilder("Cannot get encoding: "); sb.append(e.getMessage()); throw new IllegalStateException(sb.toString(), e) { // from class: org.bouncycastle.crypto.util.DerUtil.1 final IOException val$e; @Override // java.lang.Throwable public final Throwable getCause() { return this.val$e; } { this.val$e = e; } }; } } /* JADX INFO: Access modifiers changed from: package-private */ public static ASN1OctetString getOctetString(byte[] bArr) { return bArr == null ? new DEROctetString(new byte[0]) : new DEROctetString(Arrays.clone(bArr)); } DerUtil() { } }