32 lines
982 B
Java
32 lines
982 B
Java
package org.bouncycastle.asn1.x9;
|
|
|
|
import java.math.BigInteger;
|
|
import org.bouncycastle.math.ec.ECCurve;
|
|
import org.bouncycastle.math.ec.ECFieldElement;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class X9IntegerConverter {
|
|
public byte[] integerToBytes(BigInteger bigInteger, int i) {
|
|
byte[] byteArray = bigInteger.toByteArray();
|
|
if (i < byteArray.length) {
|
|
byte[] bArr = new byte[i];
|
|
System.arraycopy(byteArray, byteArray.length - i, bArr, 0, i);
|
|
return bArr;
|
|
}
|
|
if (i <= byteArray.length) {
|
|
return byteArray;
|
|
}
|
|
byte[] bArr2 = new byte[i];
|
|
System.arraycopy(byteArray, 0, bArr2, i - byteArray.length, byteArray.length);
|
|
return bArr2;
|
|
}
|
|
|
|
public int getByteLength(ECFieldElement eCFieldElement) {
|
|
return (eCFieldElement.getFieldSize() + 7) / 8;
|
|
}
|
|
|
|
public int getByteLength(ECCurve eCCurve) {
|
|
return (eCCurve.getFieldSize() + 7) / 8;
|
|
}
|
|
}
|