本文整理汇总了Java中java.security.interfaces.ECPublicKey.getW方法的典型用法代码示例。如果您正苦于以下问题:Java ECPublicKey.getW方法的具体用法?Java ECPublicKey.getW怎么用?Java ECPublicKey.getW使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.interfaces.ECPublicKey
的用法示例。
在下文中一共展示了ECPublicKey.getW方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractPublicKey
import java.security.interfaces.ECPublicKey; //导入方法依赖的package包/类
private static ECPoint extractPublicKey(final ECPublicKey ecPublicKey) {
final java.security.spec.ECPoint publicPointW = ecPublicKey.getW();
final BigInteger xCoord = publicPointW.getAffineX();
final BigInteger yCoord = publicPointW.getAffineY();
return CURVE.getCurve().createPoint(xCoord, yCoord);
}
示例2: extractPublicKey
import java.security.interfaces.ECPublicKey; //导入方法依赖的package包/类
private static ECPoint extractPublicKey(final ECPublicKey ecPublicKey) {
final java.security.spec.ECPoint publicPointW = ecPublicKey.getW();
final BigInteger xCoord = publicPointW.getAffineX();
final BigInteger yCoord = publicPointW.getAffineY();
return CURVE.getCurve().createPoint(xCoord, yCoord);
}
示例3: EC
import java.security.interfaces.ECPublicKey; //导入方法依赖的package包/类
EC(PublicKey key) throws KeyException {
super(key);
ECPublicKey ecKey = (ECPublicKey)key;
ECPoint ecPoint = ecKey.getW();
ecParams = ecKey.getParams();
try {
AccessController.doPrivileged(
new PrivilegedExceptionAction<Void>() {
public Void run() throws
ClassNotFoundException, NoSuchMethodException
{
getMethods();
return null;
}
}
);
} catch (PrivilegedActionException pae) {
throw new KeyException("ECKeyValue not supported",
pae.getException());
}
Object[] args = new Object[] { ecPoint, ecParams.getCurve() };
try {
ecPublicKey = (byte[])encodePoint.invoke(null, args);
} catch (IllegalAccessException iae) {
throw new KeyException(iae);
} catch (InvocationTargetException ite) {
throw new KeyException(ite);
}
}
示例4: EC
import java.security.interfaces.ECPublicKey; //导入方法依赖的package包/类
EC(PublicKey key) throws KeyException {
super(key);
ECPublicKey ecKey = (ECPublicKey)key;
ECPoint ecPoint = ecKey.getW();
ecParams = ecKey.getParams();
ecPublicKey = encodePoint(ecPoint, ecParams.getCurve());
}
示例5: extractPublicKey
import java.security.interfaces.ECPublicKey; //导入方法依赖的package包/类
private static ECPoint extractPublicKey(ECPublicKey ecPublicKey) {
java.security.spec.ECPoint publicPointW = ecPublicKey.getW();
BigInteger xCoord = publicPointW.getAffineX();
BigInteger yCoord = publicPointW.getAffineY();
return CURVE.getCurve()
.createPoint(xCoord, yCoord);
}
示例6: createSigner
import java.security.interfaces.ECPublicKey; //导入方法依赖的package包/类
public ConcurrentContentSigner createSigner(AlgorithmIdentifier signatureAlgId,
int parallelism) throws XiSecurityException, P11TokenException {
ParamUtil.requireMin("parallelism", parallelism, 1);
List<XiContentSigner> signers = new ArrayList<>(parallelism);
Boolean isSm2p256v1 = null;
for (int i = 0; i < parallelism; i++) {
XiContentSigner signer;
if (publicKey instanceof RSAPublicKey) {
if (i == 0 && !AlgorithmUtil.isRSASigAlgId(signatureAlgId)) {
throw new XiSecurityException(
"the given algorithm is not a valid RSA signature algorithm '"
+ signatureAlgId.getAlgorithm().getId() + "'");
}
signer = createRSAContentSigner(signatureAlgId);
} else if (publicKey instanceof ECPublicKey) {
ECPublicKey ecKey = (ECPublicKey) publicKey;
if (i == 0) {
isSm2p256v1 = GMUtil.isSm2primev2Curve(ecKey.getParams().getCurve());
if (isSm2p256v1) {
if (!AlgorithmUtil.isSm2SigAlg(signatureAlgId)) {
throw new XiSecurityException(
"the given algorithm is not a valid SM2 signature algorithm '"
+ signatureAlgId.getAlgorithm().getId() + "'");
}
} else {
if (!AlgorithmUtil.isECSigAlg(signatureAlgId)) {
throw new XiSecurityException(
"the given algorithm is not a valid EC signature algorithm '"
+ signatureAlgId.getAlgorithm().getId() + "'");
}
}
}
if (isSm2p256v1) {
java.security.spec.ECPoint w = ecKey.getW();
signer = createSM2ContentSigner(signatureAlgId, GMObjectIdentifiers.sm2p256v1,
w.getAffineX(), w.getAffineY());
} else {
signer = createECContentSigner(signatureAlgId);
}
} else if (publicKey instanceof DSAPublicKey) {
if (i == 0 && !AlgorithmUtil.isDSASigAlg(signatureAlgId)) {
throw new XiSecurityException(
"the given algorithm is not a valid DSA signature algorithm '"
+ signatureAlgId.getAlgorithm().getId() + "'");
}
signer = createDSAContentSigner(signatureAlgId);
} else {
throw new XiSecurityException("unsupported key " + publicKey.getClass().getName());
}
signers.add(signer);
} // end for
final boolean mac = false;
PrivateKey privateKey = new P11PrivateKey(cryptService, identityId);
DfltConcurrentContentSigner concurrentSigner;
try {
concurrentSigner = new DfltConcurrentContentSigner(mac, signers, privateKey);
} catch (NoSuchAlgorithmException ex) {
throw new XiSecurityException(ex.getMessage(), ex);
}
if (certificateChain != null) {
concurrentSigner.setCertificateChain(certificateChain);
} else {
concurrentSigner.setPublicKey(publicKey);
}
return concurrentSigner;
}
示例7: ECDHClientKeyExchange
import java.security.interfaces.ECPublicKey; //导入方法依赖的package包/类
ECDHClientKeyExchange(PublicKey publicKey) {
ECPublicKey ecKey = (ECPublicKey)publicKey;
ECPoint point = ecKey.getW();
ECParameterSpec params = ecKey.getParams();
encodedPoint = JsseJce.encodePoint(point, params.getCurve());
}