本文整理汇总了Java中org.spongycastle.asn1.x9.X9ECParameters.getN方法的典型用法代码示例。如果您正苦于以下问题:Java X9ECParameters.getN方法的具体用法?Java X9ECParameters.getN怎么用?Java X9ECParameters.getN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongycastle.asn1.x9.X9ECParameters
的用法示例。
在下文中一共展示了X9ECParameters.getN方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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());
}
示例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());
}
示例5: 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());
}