Java 类org.bouncycastle.crypto.params.MQVPublicParameters 实例源码

项目:gwt-crypto    文件:ECMQVBasicAgreement.java   
public BigInteger calculateAgreement(CipherParameters pubKey)
{
    if (Properties.isOverrideSet("org.bouncycastle.ec.disable_mqv"))
    {
        throw new IllegalStateException("ECMQV explicitly disabled");
    }

    MQVPublicParameters pubParams = (MQVPublicParameters)pubKey;

    ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();

    ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
        privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
        pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey()).normalize();

    if (agreement.isInfinity())
    {
        throw new IllegalStateException("Infinity is not a valid agreement value for MQV");
    }

    return agreement.getAffineXCoord().toBigInteger();
}
项目:Aki-SSL    文件:ECMQVBasicAgreement.java   
public BigInteger calculateAgreement(CipherParameters pubKey)
{
    if (Properties.isOverrideSet("org.bouncycastle.ec.disable_mqv"))
    {
        throw new IllegalStateException("ECMQV explicitly disabled");
    }

    MQVPublicParameters pubParams = (MQVPublicParameters)pubKey;

    ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();

    ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
        privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
        pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey()).normalize();

    if (agreement.isInfinity())
    {
        throw new IllegalStateException("Infinity is not a valid agreement value for MQV");
    }

    return agreement.getAffineXCoord().toBigInteger();
}
项目:TinyTravelTracker    文件:ECMQVBasicAgreement.java   
public BigInteger calculateAgreement(CipherParameters pubKey)
{
    MQVPublicParameters pubParams = (MQVPublicParameters)pubKey;

    ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();

    ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
        privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
        pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey()).normalize();

    if (agreement.isInfinity())
    {
        throw new IllegalStateException("Infinity is not a valid agreement value for MQV");
    }

    return agreement.getAffineXCoord().toBigInteger();
}
项目:CryptMeme    文件:ECMQVBasicAgreement.java   
public BigInteger calculateAgreement(CipherParameters pubKey)
{
    MQVPublicParameters pubParams = (MQVPublicParameters)pubKey;

    ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();

    ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
        privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
        pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey()).normalize();

    if (agreement.isInfinity())
    {
        throw new IllegalStateException("Infinity is not a valid agreement value for MQV");
    }

    return agreement.getAffineXCoord().toBigInteger();
}
项目:ipack    文件:ECMQVBasicAgreement.java   
public BigInteger calculateAgreement(CipherParameters pubKey)
{
    MQVPublicParameters pubParams = (MQVPublicParameters)pubKey;

    ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();

    ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
        privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
        pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey());

    return agreement.getX().toBigInteger();
}
项目:gwt-crypto    文件:ECTest.java   
private static BigInteger calculateAgreement(
    AsymmetricCipherKeyPair U1,
    AsymmetricCipherKeyPair U2,
    AsymmetricCipherKeyPair V1,
    AsymmetricCipherKeyPair V2)
{
    ECMQVBasicAgreement u = new ECMQVBasicAgreement();
    u.init(new MQVPrivateParameters(
        (ECPrivateKeyParameters)U1.getPrivate(),
        (ECPrivateKeyParameters)U2.getPrivate(),
        (ECPublicKeyParameters)U2.getPublic()));
    BigInteger ux = u.calculateAgreement(new MQVPublicParameters(
        (ECPublicKeyParameters)V1.getPublic(),
        (ECPublicKeyParameters)V2.getPublic()));

    ECMQVBasicAgreement v = new ECMQVBasicAgreement();
    v.init(new MQVPrivateParameters(
        (ECPrivateKeyParameters)V1.getPrivate(),
        (ECPrivateKeyParameters)V2.getPrivate(),
        (ECPublicKeyParameters)V2.getPublic()));
    BigInteger vx = v.calculateAgreement(new MQVPublicParameters(
        (ECPublicKeyParameters)U1.getPublic(),
        (ECPublicKeyParameters)U2.getPublic()));

    if (ux.equals(vx))
    {
        return ux;
    }

    return null;
}
项目:irma_future_id    文件:ECMQVBasicAgreement.java   
public BigInteger calculateAgreement(CipherParameters pubKey)
{
    MQVPublicParameters pubParams = (MQVPublicParameters)pubKey;

    ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();

    ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
        privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
        pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey());

    return agreement.getX().toBigInteger();
}
项目:irma_future_id    文件:ECTest.java   
private static BigInteger calculateAgreement(
    AsymmetricCipherKeyPair U1,
    AsymmetricCipherKeyPair U2,
    AsymmetricCipherKeyPair V1,
    AsymmetricCipherKeyPair V2)
{
    ECMQVBasicAgreement u = new ECMQVBasicAgreement();
    u.init(new MQVPrivateParameters(
        (ECPrivateKeyParameters)U1.getPrivate(),
        (ECPrivateKeyParameters)U2.getPrivate(),
        (ECPublicKeyParameters)U2.getPublic()));
    BigInteger ux = u.calculateAgreement(new MQVPublicParameters(
        (ECPublicKeyParameters)V1.getPublic(),
        (ECPublicKeyParameters)V2.getPublic()));

    ECMQVBasicAgreement v = new ECMQVBasicAgreement();
    v.init(new MQVPrivateParameters(
        (ECPrivateKeyParameters)V1.getPrivate(),
        (ECPrivateKeyParameters)V2.getPrivate(),
        (ECPublicKeyParameters)V2.getPublic()));
    BigInteger vx = v.calculateAgreement(new MQVPublicParameters(
        (ECPublicKeyParameters)U1.getPublic(),
        (ECPublicKeyParameters)U2.getPublic()));

    if (ux.equals(vx))
    {
        return ux;
    }

    return null;
}
项目:bc-java    文件:ECMQVBasicAgreement.java   
public BigInteger calculateAgreement(CipherParameters pubKey)
{
    MQVPublicParameters pubParams = (MQVPublicParameters)pubKey;

    ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();

    ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
        privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
        pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey());

    return agreement.getX().toBigInteger();
}
项目:bc-java    文件:ECTest.java   
private static BigInteger calculateAgreement(
    AsymmetricCipherKeyPair U1,
    AsymmetricCipherKeyPair U2,
    AsymmetricCipherKeyPair V1,
    AsymmetricCipherKeyPair V2)
{
    ECMQVBasicAgreement u = new ECMQVBasicAgreement();
    u.init(new MQVPrivateParameters(
        (ECPrivateKeyParameters)U1.getPrivate(),
        (ECPrivateKeyParameters)U2.getPrivate(),
        (ECPublicKeyParameters)U2.getPublic()));
    BigInteger ux = u.calculateAgreement(new MQVPublicParameters(
        (ECPublicKeyParameters)V1.getPublic(),
        (ECPublicKeyParameters)V2.getPublic()));

    ECMQVBasicAgreement v = new ECMQVBasicAgreement();
    v.init(new MQVPrivateParameters(
        (ECPrivateKeyParameters)V1.getPrivate(),
        (ECPrivateKeyParameters)V2.getPrivate(),
        (ECPublicKeyParameters)V2.getPublic()));
    BigInteger vx = v.calculateAgreement(new MQVPublicParameters(
        (ECPublicKeyParameters)U1.getPublic(),
        (ECPublicKeyParameters)U2.getPublic()));

    if (ux.equals(vx))
    {
        return ux;
    }

    return null;
}