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


Java ECKeyGenerationParameters类代码示例

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


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

示例1: ECKey

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的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: CryptoComponentImpl

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的package包/类
@Inject
CryptoComponentImpl(SeedProvider r) {
	if(!FortunaSecureRandom.selfTest()) throw new RuntimeException();
	SecureRandom secureRandom1 = new SecureRandom();
	if(LOG.isLoggable(INFO)) {
		String provider = secureRandom1.getProvider().getName();
		String algorithm = secureRandom1.getAlgorithm();
		LOG.info("Default SecureRandom: " + provider + " " + algorithm);
	}
	SecureRandom secureRandom2 = new FortunaSecureRandom(r.getSeed());
	secureRandom = new CombinedSecureRandom(secureRandom1, secureRandom2);
	ECKeyGenerationParameters params = new ECKeyGenerationParameters(
			PARAMETERS, secureRandom);
	agreementKeyPairGenerator = new ECKeyPairGenerator();
	agreementKeyPairGenerator.init(params);
	signatureKeyPairGenerator = new ECKeyPairGenerator();
	signatureKeyPairGenerator.init(params);
	agreementKeyParser = new Sec1KeyParser(PARAMETERS, P,
			AGREEMENT_KEY_PAIR_BITS);
	signatureKeyParser = new Sec1KeyParser(PARAMETERS, P,
			SIGNATURE_KEY_PAIR_BITS);
}
 
开发者ID:kiggundu,项目名称:briar,代码行数:23,代码来源:CryptoComponentImpl.java

示例3: MessageEncrypter

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的package包/类
MessageEncrypter(SecureRandom random) {
	generator = new ECKeyPairGenerator();
	generator.init(new ECKeyGenerationParameters(PARAMETERS, random));
	parser = new Sec1KeyParser(PARAMETERS, MESSAGE_KEY_BITS);
	KeyEncoder encoder = new PublicKeyEncoder();
	ephemeralGenerator = new EphemeralKeyPairGenerator(generator, encoder);
	ephemeralParser = new PublicKeyParser(PARAMETERS);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:9,代码来源:MessageEncrypter.java

示例4: ECKey

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的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

示例5: generateECKey

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的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

示例6: generateECKey

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的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

示例7: ECKey

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的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

示例8: ECKeyPair

import org.spongycastle.crypto.params.ECKeyGenerationParameters; //导入依赖的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.ECKeyGenerationParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。