本文整理汇总了Java中sun.security.util.ECUtil.getECParameterSpec方法的典型用法代码示例。如果您正苦于以下问题:Java ECUtil.getECParameterSpec方法的具体用法?Java ECUtil.getECParameterSpec怎么用?Java ECUtil.getECParameterSpec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.security.util.ECUtil
的用法示例。
在下文中一共展示了ECUtil.getECParameterSpec方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import sun.security.util.ECUtil; //导入方法依赖的package包/类
@Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException {
if (params instanceof ECParameterSpec) {
this.params = ECUtil.getECParameterSpec(null,
(ECParameterSpec)params);
if (this.params == null) {
throw new InvalidAlgorithmParameterException(
"Unsupported curve: " + params);
}
} else if (params instanceof ECGenParameterSpec) {
String name = ((ECGenParameterSpec)params).getName();
this.params = ECUtil.getECParameterSpec(null, name);
if (this.params == null) {
throw new InvalidAlgorithmParameterException(
"Unknown curve name: " + name);
}
} else {
throw new InvalidAlgorithmParameterException(
"ECParameterSpec or ECGenParameterSpec required for EC");
}
this.keySize =
((ECParameterSpec)this.params).getCurve().getField().getFieldSize();
this.random = random;
}
示例2: initialize
import sun.security.util.ECUtil; //导入方法依赖的package包/类
@Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException {
ECParameterSpec ecSpec = null;
if (params instanceof ECParameterSpec) {
ecSpec = ECUtil.getECParameterSpec(null,
(ECParameterSpec)params);
if (ecSpec == null) {
throw new InvalidAlgorithmParameterException(
"Unsupported curve: " + params);
}
} else if (params instanceof ECGenParameterSpec) {
String name = ((ECGenParameterSpec)params).getName();
ecSpec = ECUtil.getECParameterSpec(null, name);
if (ecSpec == null) {
throw new InvalidAlgorithmParameterException(
"Unknown curve name: " + name);
}
} else {
throw new InvalidAlgorithmParameterException(
"ECParameterSpec or ECGenParameterSpec required for EC");
}
// Not all known curves are supported by the native implementation
ensureCurveIsSupported(ecSpec);
this.params = ecSpec;
this.keySize =
((ECParameterSpec)this.params).getCurve().getField().getFieldSize();
this.random = random;
}
示例3: genECKeyPair
import sun.security.util.ECUtil; //导入方法依赖的package包/类
private KeyPair genECKeyPair(String curvName, String privD, String pubX,
String pubY, Provider p) throws Exception {
ECParameterSpec ecParams = ECUtil.getECParameterSpec(p, curvName);
ECPrivateKeySpec privKeySpec =
new ECPrivateKeySpec(new BigInteger(privD, 16), ecParams);
ECPublicKeySpec pubKeySpec =
new ECPublicKeySpec(new ECPoint(new BigInteger(pubX, 16),
new BigInteger(pubY, 16)),
ecParams);
PrivateKey privKey = kf.generatePrivate(privKeySpec);
PublicKey pubKey = kf.generatePublic(pubKeySpec);
return new KeyPair(pubKey, privKey);
}
示例4: genECKeyPair
import sun.security.util.ECUtil; //导入方法依赖的package包/类
private KeyPair genECKeyPair(String curvName, String privD, String pubX,
String pubY, Provider p) throws Exception {
ECParameterSpec ecParams = ECUtil.getECParameterSpec(p, curvName);
ECPrivateKeySpec privKeySpec =
new ECPrivateKeySpec(new BigInteger(privD, 16), ecParams);
ECPublicKeySpec pubKeySpec =
new ECPublicKeySpec(new ECPoint(new BigInteger(pubX, 16), new BigInteger(pubY, 16)),
ecParams);
PrivateKey privKey = kf.generatePrivate(privKeySpec);
PublicKey pubKey = kf.generatePublic(pubKeySpec);
return new KeyPair(pubKey, privKey);
}
示例5: getECParameterSpec
import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec getECParameterSpec(String namedCurveOid) {
return ECUtil.getECParameterSpec(cryptoProvider, namedCurveOid);
}
示例6: getECParameterSpec
import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec getECParameterSpec(String name) {
return ECUtil.getECParameterSpec(getSunECProvider(), name);
}
示例7: decodeParameters
import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec decodeParameters(byte[] params) throws IOException {
return ECUtil.getECParameterSpec(getSunECProvider(), params);
}
示例8: getECParameterSpec
import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec getECParameterSpec(ECParameterSpec spec) {
return ECUtil.getECParameterSpec(getSunECProvider(), spec);
}