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


Java ECPrivateKeyParameters.getParameters方法代码示例

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


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

示例1: JCEECPrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

    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,代码来源:JCEECPrivateKey.java

示例2: JCEECPrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

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

        this.ecSpec = new ECParameterSpec(
                        ellipticCurve,
                        new ECPoint(
                                dp.getG().getX().toBigInteger(),
                                dp.getG().getY().toBigInteger()),
                        dp.getN(),
                        dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:JCEECPrivateKey.java

示例3: BCDSTU4145PrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

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

        this.ecSpec = new ECParameterSpec(
            ellipticCurve,
            new ECPoint(
                dp.getG().getX().toBigInteger(),
                dp.getG().getY().toBigInteger()),
            dp.getN(),
            dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:BCDSTU4145PrivateKey.java

示例4: BCECPrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();
    this.configuration = configuration;

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

        this.ecSpec = new ECParameterSpec(
                        ellipticCurve,
                        new ECPoint(
                                dp.getG().getX().toBigInteger(),
                                dp.getG().getY().toBigInteger()),
                        dp.getN(),
                        dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:33,代码来源:BCECPrivateKey.java

示例5: BCECGOST3410PrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

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

        this.ecSpec = new ECParameterSpec(
                        ellipticCurve,
                        new ECPoint(
                                dp.getG().getX().toBigInteger(),
                                dp.getG().getY().toBigInteger()),
                        dp.getN(),
                        dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:BCECGOST3410PrivateKey.java

示例6: JCEECPrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

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

        this.ecSpec = new ECParameterSpec(
                        ellipticCurve,
                        new ECPoint(
                                dp.getG().getAffineXCoord().toBigInteger(),
                                dp.getG().getAffineYCoord().toBigInteger()),
                        dp.getN(),
                        dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:31,代码来源:JCEECPrivateKey.java

示例7: BCDSTU4145PrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

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

        this.ecSpec = new ECParameterSpec(
            ellipticCurve,
            new ECPoint(
                dp.getG().getAffineXCoord().toBigInteger(),
                dp.getG().getAffineYCoord().toBigInteger()),
            dp.getN(),
            dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:31,代码来源:BCDSTU4145PrivateKey.java

示例8: BCECPrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();
    this.configuration = configuration;

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

        this.ecSpec = new ECParameterSpec(
                        ellipticCurve,
                        new ECPoint(
                                dp.getG().getAffineXCoord().toBigInteger(),
                                dp.getG().getAffineYCoord().toBigInteger()),
                        dp.getN(),
                        dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:33,代码来源:BCECPrivateKey.java

示例9: BCECGOST3410PrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

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

        this.ecSpec = new ECParameterSpec(
            ellipticCurve,
            new ECPoint(
                dp.getG().getAffineXCoord().toBigInteger(),
                dp.getG().getAffineYCoord().toBigInteger()),
            dp.getN(),
            dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    this.gostParams = pubKey.getGostParams();

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:33,代码来源:BCECGOST3410PrivateKey.java

示例10: generateThresholdKey

import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
public ECCommittedSecretShareMessage[] generateThresholdKey(String keyID, ECDomainParameters domainParameters, int numberOfPeers, int threshold, ECPoint h)
{
    // TODO: should have a source of randomness.
    AsymmetricCipherKeyPair keyPair = keyManager.generateKeyPair(keyID, algorithm, numberOfPeers, domainParameters, h);

    ECPrivateKeyParameters privKey = (ECPrivateKeyParameters)keyPair.getPrivate();
    ECNewDKGSecretSplitter secretSplitter = new ECNewDKGSecretSplitter(numberOfPeers, threshold, h, privKey.getParameters(), new SecureRandom());

    ECCommittedSplitSecret splitSecret = secretSplitter.split(privKey.getD());
    ECCommittedSecretShare[] shares = splitSecret.getCommittedShares();
    ECCommittedSecretShareMessage[] messages = new ECCommittedSecretShareMessage[shares.length];

    BigInteger[] aCoefficients = splitSecret.getCoefficients();
    ECPoint[] qCommitments = new ECPoint[aCoefficients.length];

    for (int i = 0; i != qCommitments.length; i++)
    {
        qCommitments[i] = privKey.getParameters().getG().multiply(aCoefficients[i]);
    }

    for (int i = 0; i != shares.length; i++)
    {
        messages[i] = new ECCommittedSecretShareMessage(i, shares[i].getValue(), shares[i].getWitness(), shares[i].getCommitmentFactors(),
                ((ECPublicKeyParameters) keyPair.getPublic()).getQ(), qCommitments);
    }

    return messages;
}
 
开发者ID:cwgit,项目名称:ximix,代码行数:29,代码来源:ECNewDKGGenerator.java

示例11: BCECGOST3410PrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

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

        this.ecSpec = new ECParameterSpec(
            ellipticCurve,
            new ECPoint(
                dp.getG().getX().toBigInteger(),
                dp.getG().getY().toBigInteger()),
            dp.getN(),
            dp.getH().intValue());
    }
    else
    {
        this.ecSpec = spec;
    }

    this.gostParams = pubKey.getGostParams();

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:33,代码来源:BCECGOST3410PrivateKey.java

示例12: BCECPrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();
    this.configuration = configuration;

    if (spec == null)
    {
        this.ecSpec = new ECParameterSpec(
                        dp.getCurve(),
                        dp.getG(),
                        dp.getN(),
                        dp.getH(),
                        dp.getSeed());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:30,代码来源:BCECPrivateKey.java

示例13: BCECGOST3410PrivateKey

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

    this.algorithm = algorithm;
    this.d = params.getD();

    if (spec == null)
    {
        this.ecSpec = new ECParameterSpec(
                        dp.getCurve(),
                        dp.getG(),
                        dp.getN(),
                        dp.getH(),
                        dp.getSeed());
    }
    else
    {
        this.ecSpec = spec;
    }

    publicKey = getPublicKeyDetails(pubKey);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:28,代码来源:BCECGOST3410PrivateKey.java

示例14: decrypt

import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
 * Decrypt an encapsulated session key.
 *
 * @param in     the input buffer for the encapsulated key.
 * @param inOff  the offset for the input buffer.
 * @param inLen  the length of the encapsulated key.
 * @param keyLen the length of the session key.
 * @return the session key.
 */
public CipherParameters decrypt(byte[] in, int inOff, int inLen, int keyLen)
    throws IllegalArgumentException
{
    if (!(key instanceof ECPrivateKeyParameters))
    {
        throw new IllegalArgumentException("Private key required for encryption");
    }

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

    // Decode the ephemeral public key
    byte[] C = new byte[inLen];
    System.arraycopy(in, inOff, C, 0, inLen);

    // NOTE: Decoded points are already normalized (i.e in affine form)
    ECPoint gTilde = curve.decodePoint(C);

    // Compute the static-ephemeral key agreement
    ECPoint gHat = gTilde;
    if ((CofactorMode) || (OldCofactorMode))
    {
        gHat = gHat.multiply(h);
    }

    BigInteger xHat = ecPrivKey.getD();
    if (CofactorMode)
    {
        xHat = xHat.multiply(h.modInverse(n)).mod(n);
    }

    ECPoint hTilde = gHat.multiply(xHat).normalize();

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

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

示例15: decrypt

import org.bouncycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
 * Decrypt an encapsulated session key.
 *
 * @param in     the input buffer for the encapsulated key.
 * @param inOff  the offset for the input buffer.
 * @param inLen  the length of the encapsulated key.
 * @param keyLen the length of the session key.
 * @return the session key.
 */
public CipherParameters decrypt(byte[] in, int inOff, int inLen, int keyLen)
    throws IllegalArgumentException
{
    if (!(key instanceof ECPrivateKeyParameters))
    {
        throw new IllegalArgumentException("Private key required for encryption");
    }

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

    // Decode the ephemeral public key
    byte[] C = new byte[inLen];
    System.arraycopy(in, inOff, C, 0, inLen);

    // NOTE: Decoded points are already normalized (i.e in affine form)
    ECPoint gTilde = curve.decodePoint(C);

    // Compute the static-ephemeral key agreement
    ECPoint gHat = gTilde;
    if ((CofactorMode) || (OldCofactorMode))
    {
        gHat = gHat.multiply(h);
    }

    BigInteger xHat = ecPrivKey.getD();
    if (CofactorMode)
    {
        xHat = xHat.multiply(h.modInverse(n)).mod(n);
    }

    ECPoint hTilde = gHat.multiply(xHat).normalize();

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

    // Initialise the KDF
    byte[] kdfInput;
    if (SingleHashMode)
    {
        kdfInput = new byte[C.length + PEH.length];
        System.arraycopy(C, 0, kdfInput, 0, C.length);
        System.arraycopy(PEH, 0, kdfInput, C.length, PEH.length);
    }
    else
    {
        kdfInput = PEH;
    }
    kdf.init(new KDFParameters(kdfInput, null));

    // Generate the secret key
    byte[] K = new byte[keyLen];
    kdf.generateBytes(K, 0, K.length);

    return new KeyParameter(K);
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:69,代码来源:ECIESKeyEncapsulation.java


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