what-the-bank/sources/org/bouncycastle/crypto/parsers/DHIESPublicKeyParser.java

28 lines
1017 B
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.parsers;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import org.bouncycastle.crypto.KeyParser;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.params.DHParameters;
import org.bouncycastle.crypto.params.DHPublicKeyParameters;
import org.bouncycastle.util.io.Streams;
/* loaded from: classes6.dex */
public class DHIESPublicKeyParser implements KeyParser {
private DHParameters dhParams;
@Override // org.bouncycastle.crypto.KeyParser
public AsymmetricKeyParameter readKey(InputStream inputStream) throws IOException {
int bitLength = (this.dhParams.getP().bitLength() + 7) / 8;
byte[] bArr = new byte[bitLength];
Streams.readFully(inputStream, bArr, 0, bitLength);
return new DHPublicKeyParameters(new BigInteger(1, bArr), this.dhParams);
}
public DHIESPublicKeyParser(DHParameters dHParameters) {
this.dhParams = dHParameters;
}
}