org.spongycastle.jcajce.spec.MQVParameterSpec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prov Show documentation
Show all versions of prov Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
The newest version!
package org.spongycastle.jcajce.spec;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.AlgorithmParameterSpec;
import org.spongycastle.util.Arrays;
public class MQVParameterSpec
implements AlgorithmParameterSpec
{
private final PublicKey ephemeralPublicKey;
private final PrivateKey ephemeralPrivateKey;
private final PublicKey otherPartyEphemeralKey;
private final byte[] userKeyingMaterial;
public MQVParameterSpec(PublicKey ephemeralPublicKey, PrivateKey ephemeralPrivateKey, PublicKey otherPartyEphemeralKey, byte[] userKeyingMaterial)
{
this.ephemeralPublicKey = ephemeralPublicKey;
this.ephemeralPrivateKey = ephemeralPrivateKey;
this.otherPartyEphemeralKey = otherPartyEphemeralKey;
this.userKeyingMaterial = Arrays.clone(userKeyingMaterial);
}
public MQVParameterSpec(PublicKey ephemeralPublicKey, PrivateKey ephemeralPrivateKey, PublicKey otherPartyEphemeralKey)
{
this(ephemeralPublicKey, ephemeralPrivateKey, otherPartyEphemeralKey, null);
}
public MQVParameterSpec(KeyPair ephemeralKeyPair, PublicKey otherPartyEphemeralKey, byte[] userKeyingMaterial)
{
this(ephemeralKeyPair.getPublic(), ephemeralKeyPair.getPrivate(), otherPartyEphemeralKey, userKeyingMaterial);
}
public MQVParameterSpec(PrivateKey ephemeralPrivateKey, PublicKey otherPartyEphemeralKey, byte[] userKeyingMaterial)
{
this(null, ephemeralPrivateKey, otherPartyEphemeralKey, userKeyingMaterial);
}
public MQVParameterSpec(KeyPair ephemeralKeyPair, PublicKey otherPartyEphemeralKey)
{
this(ephemeralKeyPair.getPublic(), ephemeralKeyPair.getPrivate(), otherPartyEphemeralKey, null);
}
public MQVParameterSpec(PrivateKey ephemeralPrivateKey, PublicKey otherPartyEphemeralKey)
{
this(null, ephemeralPrivateKey, otherPartyEphemeralKey, null);
}
public PrivateKey getEphemeralPrivateKey()
{
return ephemeralPrivateKey;
}
public PublicKey getEphemeralPublicKey()
{
return ephemeralPublicKey;
}
public PublicKey getOtherPartyEphemeralKey()
{
return otherPartyEphemeralKey;
}
public byte[] getUserKeyingMaterial()
{
return Arrays.clone(userKeyingMaterial);
}
}