package org.bouncycastle.crypto.engines; import java.math.BigInteger; import org.bouncycastle.util.Arrays; import org.bouncycastle.util.Pack; /* loaded from: classes6.dex */ public class CramerShoupCiphertext { BigInteger e; BigInteger u1; BigInteger u2; BigInteger v; public String toString() { StringBuffer stringBuffer = new StringBuffer(); StringBuilder sb = new StringBuilder("u1: "); sb.append(this.u1.toString()); stringBuffer.append(sb.toString()); StringBuilder sb2 = new StringBuilder("\nu2: "); sb2.append(this.u2.toString()); stringBuffer.append(sb2.toString()); StringBuilder sb3 = new StringBuilder("\ne: "); sb3.append(this.e.toString()); stringBuffer.append(sb3.toString()); StringBuilder sb4 = new StringBuilder("\nv: "); sb4.append(this.v.toString()); stringBuffer.append(sb4.toString()); return stringBuffer.toString(); } public byte[] toByteArray() { byte[] byteArray = this.u1.toByteArray(); int length = byteArray.length; byte[] byteArray2 = this.u2.toByteArray(); int length2 = byteArray2.length; byte[] byteArray3 = this.e.toByteArray(); int length3 = byteArray3.length; byte[] byteArray4 = this.v.toByteArray(); int length4 = byteArray4.length; byte[] bArr = new byte[length + length2 + length3 + length4 + 16]; Pack.intToBigEndian(length, bArr, 0); System.arraycopy(byteArray, 0, bArr, 4, length); Pack.intToBigEndian(length2, bArr, length + 4); int i = length + 8; System.arraycopy(byteArray2, 0, bArr, i, length2); int i2 = i + length2; Pack.intToBigEndian(length3, bArr, i2); int i3 = i2 + 4; System.arraycopy(byteArray3, 0, bArr, i3, length3); int i4 = i3 + length3; Pack.intToBigEndian(length4, bArr, i4); System.arraycopy(byteArray4, 0, bArr, i4 + 4, length4); return bArr; } public void setV(BigInteger bigInteger) { this.v = bigInteger; } public void setU2(BigInteger bigInteger) { this.u2 = bigInteger; } public void setU1(BigInteger bigInteger) { this.u1 = bigInteger; } public void setE(BigInteger bigInteger) { this.e = bigInteger; } public BigInteger getV() { return this.v; } public BigInteger getU2() { return this.u2; } public BigInteger getU1() { return this.u1; } public BigInteger getE() { return this.e; } public CramerShoupCiphertext(byte[] bArr) { int bigEndianToInt = Pack.bigEndianToInt(bArr, 0); int i = bigEndianToInt + 4; this.u1 = new BigInteger(Arrays.copyOfRange(bArr, 4, i)); int i2 = bigEndianToInt + 8; int bigEndianToInt2 = Pack.bigEndianToInt(bArr, i) + i2; this.u2 = new BigInteger(Arrays.copyOfRange(bArr, i2, bigEndianToInt2)); int bigEndianToInt3 = Pack.bigEndianToInt(bArr, bigEndianToInt2); int i3 = bigEndianToInt2 + 4; int i4 = bigEndianToInt3 + i3; this.e = new BigInteger(Arrays.copyOfRange(bArr, i3, i4)); int bigEndianToInt4 = Pack.bigEndianToInt(bArr, i4); int i5 = i4 + 4; this.v = new BigInteger(Arrays.copyOfRange(bArr, i5, bigEndianToInt4 + i5)); } public CramerShoupCiphertext(BigInteger bigInteger, BigInteger bigInteger2, BigInteger bigInteger3, BigInteger bigInteger4) { this.u1 = bigInteger; this.u2 = bigInteger2; this.e = bigInteger3; this.v = bigInteger4; } public CramerShoupCiphertext() { } }