what-the-bank/sources/org/bouncycastle/pqc/jcajce/provider/util/KeyUtil.java

51 lines
1.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.pqc.jcajce.provider.util;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Encoding;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
/* loaded from: classes6.dex */
public class KeyUtil {
public static byte[] getEncodedSubjectPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo) {
try {
return subjectPublicKeyInfo.getEncoded(ASN1Encoding.DER);
} catch (Exception unused) {
return null;
}
}
public static byte[] getEncodedSubjectPublicKeyInfo(AlgorithmIdentifier algorithmIdentifier, byte[] bArr) {
try {
return getEncodedSubjectPublicKeyInfo(new SubjectPublicKeyInfo(algorithmIdentifier, bArr));
} catch (Exception unused) {
return null;
}
}
public static byte[] getEncodedSubjectPublicKeyInfo(AlgorithmIdentifier algorithmIdentifier, ASN1Encodable aSN1Encodable) {
try {
return getEncodedSubjectPublicKeyInfo(new SubjectPublicKeyInfo(algorithmIdentifier, aSN1Encodable));
} catch (Exception unused) {
return null;
}
}
public static byte[] getEncodedPrivateKeyInfo(AlgorithmIdentifier algorithmIdentifier, ASN1Encodable aSN1Encodable) {
try {
return getEncodedPrivateKeyInfo(new PrivateKeyInfo(algorithmIdentifier, aSN1Encodable.toASN1Primitive()));
} catch (Exception unused) {
return null;
}
}
public static byte[] getEncodedPrivateKeyInfo(PrivateKeyInfo privateKeyInfo) {
try {
return privateKeyInfo.getEncoded(ASN1Encoding.DER);
} catch (Exception unused) {
return null;
}
}
}