org.bouncycastle.jcajce.spec.MQVParameterSpec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-ext-debug-jdk15on Show documentation
Show all versions of bcprov-ext-debug-jdk15on Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8 with debug enabled.
package org.bouncycastle.jcajce.spec;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.AlgorithmParameterSpec;
import org.bouncycastle.util.Arrays;
/**
* Parameter spec to provide MQV ephemeral keys and user keying material.
*/
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);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy