what-the-bank/sources/org/bouncycastle/crypto/params/MQVPrivateParameters.java

48 lines
2.1 KiB
Java

package org.bouncycastle.crypto.params;
import org.bouncycastle.crypto.CipherParameters;
/* loaded from: classes6.dex */
public class MQVPrivateParameters implements CipherParameters {
private ECPrivateKeyParameters ephemeralPrivateKey;
private ECPublicKeyParameters ephemeralPublicKey;
private ECPrivateKeyParameters staticPrivateKey;
public ECPrivateKeyParameters getStaticPrivateKey() {
return this.staticPrivateKey;
}
public ECPublicKeyParameters getEphemeralPublicKey() {
return this.ephemeralPublicKey;
}
public ECPrivateKeyParameters getEphemeralPrivateKey() {
return this.ephemeralPrivateKey;
}
public MQVPrivateParameters(ECPrivateKeyParameters eCPrivateKeyParameters, ECPrivateKeyParameters eCPrivateKeyParameters2, ECPublicKeyParameters eCPublicKeyParameters) {
if (eCPrivateKeyParameters == null) {
throw new NullPointerException("staticPrivateKey cannot be null");
}
if (eCPrivateKeyParameters2 == null) {
throw new NullPointerException("ephemeralPrivateKey cannot be null");
}
ECDomainParameters parameters = eCPrivateKeyParameters.getParameters();
if (!parameters.equals(eCPrivateKeyParameters2.getParameters())) {
throw new IllegalArgumentException("Static and ephemeral private keys have different domain parameters");
}
if (eCPublicKeyParameters == null) {
eCPublicKeyParameters = new ECPublicKeyParameters(parameters.getG().multiply(eCPrivateKeyParameters2.getD()), parameters);
} else if (!parameters.equals(eCPublicKeyParameters.getParameters())) {
throw new IllegalArgumentException("Ephemeral public key has different domain parameters");
}
this.staticPrivateKey = eCPrivateKeyParameters;
this.ephemeralPrivateKey = eCPrivateKeyParameters2;
this.ephemeralPublicKey = eCPublicKeyParameters;
}
public MQVPrivateParameters(ECPrivateKeyParameters eCPrivateKeyParameters, ECPrivateKeyParameters eCPrivateKeyParameters2) {
this(eCPrivateKeyParameters, eCPrivateKeyParameters2, null);
}
}