当前位置: 首页>>代码示例>>Java>>正文


Java ECPublicKeyParameters.getParameters方法代码示例

本文整理汇总了Java中org.bouncycastle.crypto.params.ECPublicKeyParameters.getParameters方法的典型用法代码示例。如果您正苦于以下问题:Java ECPublicKeyParameters.getParameters方法的具体用法?Java ECPublicKeyParameters.getParameters怎么用?Java ECPublicKeyParameters.getParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.crypto.params.ECPublicKeyParameters的用法示例。


在下文中一共展示了ECPublicKeyParameters.getParameters方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JCEECPublicKey

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public JCEECPublicKey(
    String                  algorithm,
    ECPublicKeyParameters   params,
    ECParameterSpec         spec)
{
    ECDomainParameters      dp = params.getParameters();

    this.algorithm = algorithm;
    this.q = params.getQ();

    if (spec == null)
    {
        EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());

        this.ecSpec = createSpec(ellipticCurve, dp);
    }
    else
    {
        this.ecSpec = spec;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:JCEECPublicKey.java

示例2: BCDSTU4145PublicKey

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCDSTU4145PublicKey(
    String algorithm,
    ECPublicKeyParameters params,
    ECParameterSpec spec)
{
    ECDomainParameters dp = params.getParameters();

    this.algorithm = algorithm;
    this.q = params.getQ();

    if (spec == null)
    {
        EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());

        this.ecSpec = createSpec(ellipticCurve, dp);
    }
    else
    {
        this.ecSpec = spec;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:BCDSTU4145PublicKey.java

示例3: BCECPublicKey

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCECPublicKey(
    String algorithm,
    ECPublicKeyParameters params,
    ECParameterSpec spec,
    ProviderConfiguration configuration)
{
    ECDomainParameters      dp = params.getParameters();

    this.algorithm = algorithm;
    this.q = params.getQ();

    if (spec == null)
    {
        EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());

        this.ecSpec = createSpec(ellipticCurve, dp);
    }
    else
    {
        this.ecSpec = spec;
    }

    this.configuration = configuration;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:BCECPublicKey.java

示例4: BCECGOST3410PublicKey

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PublicKey(
    String algorithm,
    ECPublicKeyParameters params,
    ECParameterSpec spec)
{
    ECDomainParameters      dp = params.getParameters();

    this.algorithm = algorithm;
    this.q = params.getQ();

    if (spec == null)
    {
        EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());

        this.ecSpec = createSpec(ellipticCurve, dp);
    }
    else
    {
        this.ecSpec = spec;
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:BCECGOST3410PublicKey.java

示例5: JCEECPublicKey

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
JCEECPublicKey(
    String                  algorithm,
    ECPublicKeyParameters   params,
    ECParameterSpec         spec)
{
    ECDomainParameters      dp = params.getParameters();

    this.algorithm = algorithm;
    this.q = params.getQ();

    if (spec == null)
    {
        this.ecSpec = new ECParameterSpec(
                        dp.getCurve(),
                        dp.getG(),
                        dp.getN(),
                        dp.getH(),
                        dp.getSeed());
    }
    else
    {
        this.ecSpec = spec;
    }
}
 
开发者ID:thangbn,项目名称:Direct-File-Downloader,代码行数:25,代码来源:JCEECPublicKey.java

示例6: calculateAgreement

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BigInteger calculateAgreement(
    CipherParameters pubKey)
{
    ECPublicKeyParameters pub = (ECPublicKeyParameters)pubKey;
    ECDomainParameters params = pub.getParameters();

    BigInteger hd = params.getH().multiply(key.getD()).mod(params.getN());

    ECPoint P = pub.getQ().multiply(hd).normalize();

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

    return P.getAffineXCoord().toBigInteger();
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:18,代码来源:ECDHCBasicAgreement.java

示例7: BCECGOST3410PublicKey

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BCECGOST3410PublicKey(
    String algorithm,
    ECPublicKeyParameters params,
    ECParameterSpec spec)
{
    ECDomainParameters dp = params.getParameters();

    this.algorithm = algorithm;
    this.q = params.getQ();

    if (spec == null)
    {
        EllipticCurve ellipticCurve = EC5Util.convertCurve(dp.getCurve(), dp.getSeed());

        this.ecSpec = createSpec(ellipticCurve, dp);
    }
    else
    {
        this.ecSpec = spec;
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:22,代码来源:BCECGOST3410PublicKey.java

示例8: calculateAgreement

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
public BigInteger calculateAgreement(
    CipherParameters pubKey)
{
    ECPublicKeyParameters   pub = (ECPublicKeyParameters)pubKey;
    ECDomainParameters      params = pub.getParameters();
    ECPoint P = pub.getQ().multiply(params.getH().multiply(key.getD()));

    // if (p.isInfinity()) throw new RuntimeException("Invalid public key");

    return P.getX().toBigInteger();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:ECDHCBasicAgreement.java

示例9: encrypt

import org.bouncycastle.crypto.params.ECPublicKeyParameters; //导入方法依赖的package包/类
/**
 * Generate and encapsulate a random session key.
 *
 * @param out    the output buffer for the encapsulated key.
 * @param outOff the offset for the output buffer.
 * @param keyLen the length of the session key.
 * @return the random session key.
 */
public CipherParameters encrypt(byte[] out, int outOff, int keyLen)
    throws IllegalArgumentException
{
    if (!(key instanceof ECPublicKeyParameters))
    {
        throw new IllegalArgumentException("Public key required for encryption");
    }

    ECPublicKeyParameters ecPubKey = (ECPublicKeyParameters)key;
    ECDomainParameters ecParams = ecPubKey.getParameters();
    ECCurve curve = ecParams.getCurve();
    BigInteger n = ecParams.getN();
    BigInteger h = ecParams.getH();

    // Generate the ephemeral key pair    
    BigInteger r = BigIntegers.createRandomInRange(ONE, n, rnd);

    // Compute the static-ephemeral key agreement
    BigInteger rPrime = CofactorMode ? r.multiply(h).mod(n) : r;

    ECMultiplier basePointMultiplier = createBasePointMultiplier();

    ECPoint[] ghTilde = new ECPoint[]{ 
        basePointMultiplier.multiply(ecParams.getG(), r),
        ecPubKey.getQ().multiply(rPrime)
    };

    // NOTE: More efficient than normalizing each individually
    curve.normalizeAll(ghTilde);

    ECPoint gTilde = ghTilde[0], hTilde = ghTilde[1];

    // Encode the ephemeral public key
    byte[] C = gTilde.getEncoded(false);
    System.arraycopy(C, 0, out, outOff, C.length);

    // Encode the shared secret value
    byte[] PEH = hTilde.getAffineXCoord().getEncoded();

    return deriveKey(keyLen, C, PEH);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:50,代码来源:ECIESKeyEncapsulation.java


注:本文中的org.bouncycastle.crypto.params.ECPublicKeyParameters.getParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。