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


Java ECPrivateKeyParameters.getD方法代码示例

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


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

示例1: ECKey

import org.spongycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
 * Generates an entirely new keypair. Point compression is used so the resulting public key will be 33 bytes
 * (32 for the co-ordinate and 1 byte to represent the y bit).
 */
public ECKey() {
    ECKeyPairGenerator generator = new ECKeyPairGenerator();
    ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters(ecParams, secureRandom);
    generator.init(keygenParams);
    AsymmetricCipherKeyPair keypair = generator.generateKeyPair();
    ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate();
    ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic();
    priv = privParams.getD();
    // Unfortunately Bouncy Castle does not let us explicitly change a point to be compressed, even though it
    // could easily do so. We must re-build it here so the ECPoints withCompression flag can be set to true.
    ECPoint uncompressed = pubParams.getQ();
    ECPoint compressed = compressPoint(uncompressed);
    pub = compressed.getEncoded();

    creationTimeSeconds = Utils.now().getTime() / 1000;
}
 
开发者ID:appteam-nith,项目名称:NithPointsj,代码行数:21,代码来源:ECKey.java

示例2: ECKey

import org.spongycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
 * Generates an entirely new keypair with the given {@link SecureRandom}
 * object. Point compression is used so the resulting public key will be 33
 * bytes (32 for the co-ordinate and 1 byte to represent the y bit).
 */
public ECKey(SecureRandom secureRandom) {
    ECKeyPairGenerator generator = new ECKeyPairGenerator();
    ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters(CURVE, secureRandom);
    generator.init(keygenParams);
    AsymmetricCipherKeyPair keypair = generator.generateKeyPair();
    ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate();
    ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic();
    priv = privParams.getD();
    pub = new LazyECPoint(CURVE.getCurve(), pubParams.getQ().getEncoded(true));
    creationTimeSeconds = CryptoUtils.currentTimeSeconds();
}
 
开发者ID:marvin-we,项目名称:crypto-core,代码行数:17,代码来源:ECKey.java

示例3: generateECKey

import org.spongycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
     * Generates an entirely new keypair. Point compression is used so the resulting public key will be 33 bytes
     * (32 for the co-ordinate and 1 byte to represent the y bit).
     */
    public static ECKey generateECKey(SecureRandom secureRandom) {

        ECKeyPairGenerator generator = new ECKeyPairGenerator();
        ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters(CURVE, secureRandom);
        generator.init(keygenParams);
        AsymmetricCipherKeyPair keypair = generator.generateKeyPair();
        ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate();
        ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic();
        BigInteger priv = privParams.getD();
        boolean compressed = true;
        ECKey ecKey = new ECKey(priv, pubParams.getQ().getEncoded(compressed));
//        ecKey.setCreationTimeSeconds(Utils.currentTimeSeconds());
        return ecKey;
    }
 
开发者ID:chaincloud-dot-com,项目名称:chaincloud-v,代码行数:19,代码来源:ECKey.java

示例4: generateECKey

import org.spongycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
 * Generates an entirely new keypair. Point compression is used so the resulting public key will be 33 bytes
 * (32 for the co-ordinate and 1 byte to represent the y bit).
 */
public static ECKey generateECKey(SecureRandom secureRandom) {

    ECKeyPairGenerator generator = new ECKeyPairGenerator();
    ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters(CURVE, secureRandom);
    generator.init(keygenParams);
    AsymmetricCipherKeyPair keypair = generator.generateKeyPair();
    ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate();
    ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic();
    BigInteger priv = privParams.getD();
    boolean compressed = true;
    ECKey ecKey = new ECKey(priv, pubParams.getQ().getEncoded(compressed));
    ecKey.setCreationTimeSeconds(Utils.currentTimeSeconds());
    return ecKey;
}
 
开发者ID:bither,项目名称:bitherj,代码行数:19,代码来源:ECKey.java

示例5: ECKey

import org.spongycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/**
 * Generates an entirely new keypair with the given {@link SecureRandom} object. Point compression is used so the
 * resulting public key will be 33 bytes (32 for the co-ordinate and 1 byte to represent the y bit).
 */
public ECKey(SecureRandom secureRandom) {
    ECKeyPairGenerator generator = new ECKeyPairGenerator();
    ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters(CURVE, secureRandom);
    generator.init(keygenParams);
    AsymmetricCipherKeyPair keypair = generator.generateKeyPair();
    ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate();
    ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic();
    priv = privParams.getD();
    pub = CURVE.getCurve().decodePoint(pubParams.getQ().getEncoded(true));
}
 
开发者ID:ethereumj,项目名称:ethereumj,代码行数:15,代码来源:ECKey.java

示例6: ECKeyPair

import org.spongycastle.crypto.params.ECPrivateKeyParameters; //导入方法依赖的package包/类
/** 
 * Generates an entirely new keypair. 
 * */
public ECKeyPair() 
{
    ECKeyPairGenerator generator = new ECKeyPairGenerator();
    ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters(ecParams, secureRandom);
    generator.init(keygenParams);
    AsymmetricCipherKeyPair keypair = generator.generateKeyPair();
    ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate();
    ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic();
    priv = privParams.getD();
    pub = pubParams.getQ().getEncoded();// The public key is an encoded point on the elliptic curve. It has no meaning independent of the curve.
}
 
开发者ID:JonathanCoe,项目名称:bitseal,代码行数:15,代码来源:ECKeyPair.java


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