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


Java X9ECParameters类代码示例

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


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

示例1: getParameterSpec

import org.spongycastle.asn1.x9.X9ECParameters; //导入依赖的package包/类
/**
 * Retrieves the parameters of the given elliptic curve.
 * @param curveName The curve name
 * @param custom Custom or not?
 * @return The elliptic curve parameters.
 */
private static ECParameterSpec getParameterSpec(String curveName, boolean custom) {
    if(custom) {
        X9ECParameters ecP = CustomNamedCurves.getByName(curveName);
        return new ECParameterSpec(ecP.getCurve(), ecP.getG(),
                ecP.getN(), ecP.getH(), ecP.getSeed());

    }
    return ECNamedCurveTable.getParameterSpec(curveName);
}
 
开发者ID:wkmeijer,项目名称:CS4160-trustchain-android,代码行数:16,代码来源:Key.java

示例2: signAndFromatToRS

import org.spongycastle.asn1.x9.X9ECParameters; //导入依赖的package包/类
/**
 * UAF_ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW 0x01
 * An ECDSA signature on the NIST secp256r1 curve which MUST have raw R and S buffers, encoded in big-endian order.
 * I.e. [R (32 bytes), S (32 bytes)]
 * 
 * @param priv - Private key
 * @param input - Data to sign 
 * @return BigInteger[] - [R,S]
 */
public static BigInteger[] signAndFromatToRS(PrivateKey priv, byte[] input) {
	X9ECParameters params = SECNamedCurves.getByName("secp256r1");
	ECDomainParameters ecParams = new ECDomainParameters(params.getCurve(),
			params.getG(), params.getN(), params.getH());
	if (priv == null)
		throw new IllegalStateException(
				"This ECKey does not have the private key necessary for signing.");
	ECDSASigner signer = new ECDSASigner();
	ECPrivateKeyParameters privKey = new ECPrivateKeyParameters(
			((ECPrivateKey) priv).getS(), ecParams);
	signer.init(true, privKey);
	BigInteger[] sigs = signer.generateSignature(input);
	return sigs;
}
 
开发者ID:zsavvas,项目名称:ReCRED_FIDO_UAF_OIDC,代码行数:24,代码来源:NamedCurve.java

示例3: verify

import org.spongycastle.asn1.x9.X9ECParameters; //导入依赖的package包/类
public static boolean verify(byte[] pub, byte[] dataForSigning,
		BigInteger[] rs) throws Exception {
	ECDSASigner signer = new ECDSASigner();
	X9ECParameters params = SECNamedCurves.getByName("secp256r1");
	ECDomainParameters ecParams = new ECDomainParameters(params.getCurve(),
			params.getG(), params.getN(), params.getH());
	ECPublicKeyParameters pubKeyParams = new ECPublicKeyParameters(ecParams
			.getCurve().decodePoint(pub), ecParams);
	signer.init(false, pubKeyParams);

	return signer.verifySignature(dataForSigning, rs[0].abs(), rs[1].abs());
}
 
开发者ID:zsavvas,项目名称:ReCRED_FIDO_UAF_OIDC,代码行数:13,代码来源:NamedCurve.java

示例4: verify

import org.spongycastle.asn1.x9.X9ECParameters; //导入依赖的package包/类
public static boolean verify(byte[] pub, byte[] dataForSigning,
		BigInteger[] rs) {
	ECDSASigner signer = new ECDSASigner();
	X9ECParameters params = SECNamedCurves.getByName("secp256r1");
	ECDomainParameters ecParams = new ECDomainParameters(params.getCurve(),
			params.getG(), params.getN(), params.getH());
	ECPublicKeyParameters pubKeyParams = new ECPublicKeyParameters(ecParams
			.getCurve().decodePoint(pub), ecParams);
	signer.init(false, pubKeyParams);

	return signer.verifySignature(dataForSigning, rs[0].abs(), rs[1].abs());
}
 
开发者ID:eBay,项目名称:UAF,代码行数:13,代码来源:NamedCurve.java

示例5: getPublicKey

import org.spongycastle.asn1.x9.X9ECParameters; //导入依赖的package包/类
@Override
public byte[] getPublicKey(boolean compress, int... index) throws PinModeLockedException, UnusableIndexException, IOException, NoKeyLoadedException {
    DeterministicKey key = getKey(index);
    X9ECParameters params = SECNamedCurves.getByName("secp256k1");
    ECPoint point = params.getCurve().decodePoint(key.toECKey().getPubKey());
    point = new ECPoint.Fp(point.getCurve(), point.getX(), point.getY(), compress);
    return point.getEncoded();
}
 
开发者ID:Yubico,项目名称:yubico-bitcoin-java,代码行数:9,代码来源:YkneoBitcoinSoft.java

示例6: convertParams

import org.spongycastle.asn1.x9.X9ECParameters; //导入依赖的package包/类
private static ECDomainParameters convertParams(X9ECParameters in) {
	return new ECDomainParameters(in.getCurve(), in.getG(), in.getN(),
			in.getH());
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:5,代码来源:EllipticCurvePerformanceTest.java


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