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


Java ECParameterSpec.getCurve方法代码示例

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


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

示例1: getCurveName

import java.security.spec.ECParameterSpec; //导入方法依赖的package包/类
public static String getCurveName(ECParameterSpec spec)
    throws InvalidAlgorithmParameterException
{
    int curve_id;

    /* Ecc object doesn't need to be initialied before call */
    if (!(spec.getCurve().getField() instanceof ECFieldFp)) {
        throw new InvalidAlgorithmParameterException(
            "Currently only ECFieldFp fields supported");
    }
    ECFieldFp field = (ECFieldFp)spec.getCurve().getField();
    EllipticCurve curve = spec.getCurve();

    curve_id = wc_ecc_get_curve_id_from_params(
                field.getFieldSize(),
                field.getP().toByteArray(),
                curve.getA().toByteArray(),
                curve.getB().toByteArray(),
                spec.getOrder().toByteArray(),
                spec.getGenerator().getAffineX().toByteArray(),
                spec.getGenerator().getAffineY().toByteArray(),
                spec.getCofactor());

    return wc_ecc_get_curve_name_from_id(curve_id);
}
 
开发者ID:wolfSSL,项目名称:wolfcrypt-jni,代码行数:26,代码来源:Ecc.java

示例2: mapNonceGMWithECDH

import java.security.spec.ECParameterSpec; //导入方法依赖的package包/类
private static ECParameterSpec mapNonceGMWithECDH(final BigInteger nonceS,
		                                          final ECPoint sharedSecretPointH,
		                                          final ECParameterSpec params) {
	// D~ = (p, a, b, G~, n, h) where G~ = [s]G + H
	final ECPoint generator = params.getGenerator();
	final EllipticCurve curve = params.getCurve();
	final BigInteger a = curve.getA();
	final BigInteger b = curve.getB();
	final ECFieldFp field = (ECFieldFp)curve.getField();
	final BigInteger p = field.getP();
	final BigInteger order = params.getOrder();
	final int cofactor = params.getCofactor();
	final ECPoint ephemeralGenerator = add(multiply(nonceS, generator, params), sharedSecretPointH, params);
	if (!toBouncyCastleECPoint(ephemeralGenerator, params).isValid()) {
		LOGGER.warning("Se ha generado un punto invalido"); //$NON-NLS-1$
	}
	return new ECParameterSpec(new EllipticCurve(new ECFieldFp(p), a, b), ephemeralGenerator, order, cofactor);
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:19,代码来源:JseCryptoHelper.java

示例3: mapNonceGMWithECDH

import java.security.spec.ECParameterSpec; //导入方法依赖的package包/类
private static ECParameterSpec mapNonceGMWithECDH(final BigInteger nonceS,
		                                          final ECPoint sharedSecretPointH,
		                                          final ECParameterSpec params) {
	// D~ = (p, a, b, G~, n, h) where G~ = [s]G + H
	final ECPoint generator = params.getGenerator();
	final EllipticCurve curve = params.getCurve();
	final BigInteger a = curve.getA();
	final BigInteger b = curve.getB();
	final ECFieldFp field = (ECFieldFp)curve.getField();
	final BigInteger p = field.getP();
	final BigInteger order = params.getOrder();
	final int cofactor = params.getCofactor();
	final ECPoint ephemeralGenerator = add(multiply(nonceS, generator, params), sharedSecretPointH, params);
	if (!toSpongyCastleECPoint(ephemeralGenerator, params).isValid()) {
		LOGGER.warning("Se ha generado un punto invalido"); //$NON-NLS-1$
	}
	return new ECParameterSpec(new EllipticCurve(new ECFieldFp(p), a, b), ephemeralGenerator, order, cofactor);
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:19,代码来源:JseCryptoHelper.java

示例4: toBouncyCastleECCurve

import java.security.spec.ECParameterSpec; //导入方法依赖的package包/类
private static ECCurve toBouncyCastleECCurve(final ECParameterSpec params) {
	final EllipticCurve curve = params.getCurve();
	final ECField field = curve.getField();
	if (!(field instanceof ECFieldFp)) {
		throw new IllegalArgumentException(
			"Solo se soporta 'ECFieldFp' y se proporciono  " + field.getClass().getCanonicalName() //$NON-NLS-1$
		);
	}
	final int coFactor = params.getCofactor();
	final BigInteger order = params.getOrder();
	final BigInteger a = curve.getA();
	final BigInteger b = curve.getB();
	final BigInteger p = getPrime(params);
	return new ECCurve.Fp(p, a, b, order, BigInteger.valueOf(coFactor));
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:16,代码来源:JseCryptoHelper.java

示例5: getPrime

import java.security.spec.ECParameterSpec; //导入方法依赖的package包/类
private static BigInteger getPrime(final ECParameterSpec params) {
	if (params == null) {
		throw new IllegalArgumentException(
			"Los parametros no pueden ser nulos" //$NON-NLS-1$
		);
	}
	final EllipticCurve curve = params.getCurve();
	final ECField field = curve.getField();
	if (!(field instanceof ECFieldFp)) {
		throw new IllegalStateException(
			"Solo se soporta 'ECFieldFp' y se proporciono  " + field.getClass().getCanonicalName() //$NON-NLS-1$
		);
	}
	return ((ECFieldFp)field).getP();
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:16,代码来源:JseCryptoHelper.java

示例6: toSpongyCastleECCurve

import java.security.spec.ECParameterSpec; //导入方法依赖的package包/类
private static ECCurve toSpongyCastleECCurve(final ECParameterSpec params) {
	final EllipticCurve curve = params.getCurve();
	final ECField field = curve.getField();
	if (!(field instanceof ECFieldFp)) {
		throw new IllegalArgumentException(
			"Solo se soporta 'ECFieldFp' y se proporciono  " + field.getClass().getCanonicalName() //$NON-NLS-1$
		);
	}
	final int coFactor = params.getCofactor();
	final BigInteger order = params.getOrder();
	final BigInteger a = curve.getA();
	final BigInteger b = curve.getB();
	final BigInteger p = getPrime(params);
	return new ECCurve.Fp(p, a, b, order, BigInteger.valueOf(coFactor));
}
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:16,代码来源:JseCryptoHelper.java


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