本文整理了Java中org.bouncycastle.math.ec.ECPoint.getRawYCoord()
方法的一些代码示例,展示了ECPoint.getRawYCoord()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ECPoint.getRawYCoord()
方法的具体详情如下:
包路径:org.bouncycastle.math.ec.ECPoint
类名称:ECPoint
方法名:getRawYCoord
暂无
代码示例来源:origin: redfish64/TinyTravelTracker
public String toString()
{
if (this.isInfinity())
{
return "INF";
}
StringBuffer sb = new StringBuffer();
sb.append('(');
sb.append(getRawXCoord());
sb.append(',');
sb.append(getRawYCoord());
for (int i = 0; i < zs.length; ++i)
{
sb.append(',');
sb.append(zs[i]);
}
sb.append(')');
return sb.toString();
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
public String toString()
{
if (this.isInfinity())
{
return "INF";
}
StringBuffer sb = new StringBuffer();
sb.append('(');
sb.append(getRawXCoord());
sb.append(',');
sb.append(getRawYCoord());
for (int i = 0; i < zs.length; ++i)
{
sb.append(',');
sb.append(zs[i]);
}
sb.append(')');
return sb.toString();
}
代码示例来源:origin: com.cryptape.cita/crypto
public static String getAddress(ECPoint key) {
String publicKey = key.getRawXCoord().toString() + key.getRawYCoord().toString();
return getAddress(publicKey);
}
代码示例来源:origin: RUB-NDS/TLS-Attacker
private CustomECPoint toCustomECPoint(ECPublicKey key) {
ECPoint q = key.getQ();
return new CustomECPoint(q.getRawXCoord().toBigInteger(), q.getRawYCoord().toBigInteger());
}
代码示例来源:origin: redfish64/TinyTravelTracker
protected ECPoint createScaledPoint(ECFieldElement sx, ECFieldElement sy)
{
return this.getCurve().createRawPoint(getRawXCoord().multiply(sx), getRawYCoord().multiply(sy), this.withCompression);
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
protected ECPoint createScaledPoint(ECFieldElement sx, ECFieldElement sy)
{
return this.getCurve().createRawPoint(getRawXCoord().multiply(sx), getRawYCoord().multiply(sy), this.withCompression);
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
public ECPoint scaleY(ECFieldElement scale)
{
return isInfinity()
? this
: getCurve().createRawPoint(getRawXCoord(), getRawYCoord().multiply(scale), getRawZCoords(), this.withCompression);
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
public ECPoint scaleX(ECFieldElement scale)
{
return isInfinity()
? this
: getCurve().createRawPoint(getRawXCoord().multiply(scale), getRawYCoord(), getRawZCoords(), this.withCompression);
}
代码示例来源:origin: redfish64/TinyTravelTracker
public ECPoint scaleX(ECFieldElement scale)
{
return isInfinity()
? this
: getCurve().createRawPoint(getRawXCoord().multiply(scale), getRawYCoord(), getRawZCoords(), this.withCompression);
}
代码示例来源:origin: redfish64/TinyTravelTracker
public ECPoint scaleY(ECFieldElement scale)
{
return isInfinity()
? this
: getCurve().createRawPoint(getRawXCoord(), getRawYCoord().multiply(scale), getRawZCoords(), this.withCompression);
}
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
Nat256.copy(((SecP256R1FieldElement)p.getRawYCoord()).x, 0, table, pos); pos += FE_INTS;
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
Nat256.copy(((Curve25519FieldElement)p.getRawYCoord()).x, 0, table, pos); pos += FE_INTS;
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
Nat256.copy64(((SecT193FieldElement)p.getRawYCoord()).x, 0, table, pos); pos += FE_LONGS;
代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on
Nat192.copy64(((SecT163FieldElement)p.getRawYCoord()).x, 0, table, pos); pos += FE_LONGS;
代码示例来源:origin: RUB-NDS/TLS-Attacker
public static CustomECPoint createClassicEcPublicKey(NamedGroup group, BigInteger privateKey) {
if (!group.isStandardCurve()) {
throw new IllegalArgumentException(
"Cannot create ClassicEcPublicKey for group which is not a classic curve:" + group.name());
}
ECDomainParameters ecDomainParameters = generateEcParameters(group);
ECPoint ecPoint = ecDomainParameters.getG().multiply(privateKey);
ecPoint = ecPoint.normalize();
if (ecPoint.isInfinity()) {
// TODO ???
return new CustomECPoint(BigInteger.ZERO, BigInteger.ZERO);
}
return new CustomECPoint(ecPoint.getRawXCoord().toBigInteger(), ecPoint.getRawYCoord().toBigInteger());
}
代码示例来源:origin: RUB-NDS/TLS-Attacker
private void adjustClientPublicKey(ECDHClientKeyExchangeMessage message) {
byte[] serializedPoint = message.getPublicKey().getValue();
List<ECPointFormat> pointFormatList = tlsContext.getChooser().getServerSupportedPointFormats();
ECPointFormat[] formatArray = pointFormatList.toArray(new ECPointFormat[pointFormatList.size()]);
NamedGroup usedGroup = tlsContext.getChooser().getSelectedNamedGroup();
ECDomainParameters ecParams = getDomainParameters(tlsContext.getChooser().getEcCurveType(), usedGroup);
short[] pointFormats = ECCUtilsBCWrapper.convertPointFormats(formatArray);
try {
ECPublicKeyParameters clientPublicKey = TlsECCUtils.deserializeECPublicKey(pointFormats, ecParams,
serializedPoint);
tlsContext.setClientEcPublicKey(new CustomECPoint(clientPublicKey.getQ().getRawXCoord().toBigInteger(),
clientPublicKey.getQ().getRawYCoord().toBigInteger()));
} catch (IOException ex) {
LOGGER.info("Could not deserialize EC point (it is possible that some of your modifications made "
+ "the EC point invalid)");
LOGGER.debug(
"EC point that was attempted to be deserialized: "
+ ArrayConverter.bytesToHexString(serializedPoint), ex);
}
}
代码示例来源:origin: com.cryptape.cita/crypto
public static byte[] getSignature(Signature signature, ECPoint publicKey) {
String publicKeyBytes = fillStr64(publicKey.getRawXCoord().toString()) + fillStr64(publicKey.getRawYCoord().toString());
return join(HexUtil.hexToBytes(signature.getSign()), HexUtil.hexToBytes(publicKeyBytes));
}
代码示例来源:origin: RUB-NDS/TLS-Attacker
protected void setComputationPublicKey(T msg, boolean clientMode) {
if (clientMode) {
msg.getComputations().setPublicKey(chooser.getServerEcPublicKey().getX(),
chooser.getServerEcPublicKey().getY());
} else {
serializedPoint = msg.getPublicKey().getValue();
List<ECPointFormat> pointFormatList = chooser.getServerSupportedPointFormats();
ECPointFormat[] formatArray = pointFormatList.toArray(new ECPointFormat[pointFormatList.size()]);
NamedGroup usedGroup = chooser.getSelectedNamedGroup();
ECDomainParameters ecParams = getDomainParameters(chooser.getEcCurveType(), usedGroup);
short[] pointFormats = ECCUtilsBCWrapper.convertPointFormats(formatArray);
try {
ECPublicKeyParameters clientPublicKey = TlsECCUtils.deserializeECPublicKey(pointFormats, ecParams,
serializedPoint);
ECPoint q = clientPublicKey.getQ();
q = q.normalize();
msg.getComputations().setPublicKey(q.getRawXCoord().toBigInteger(), q.getRawYCoord().toBigInteger());
} catch (IOException ex) {
throw new PreparationException("Could not deserialize EC Point: "
+ ArrayConverter.bytesToHexString(serializedPoint), ex);
}
}
LOGGER.debug("Computation PublicKey: " + msg.getComputations().getPublicKey().toString());
}
代码示例来源:origin: RUB-NDS/TLS-Attacker
@Override
public void prepareAfterParse(boolean clientMode) {
msg.prepareComputations();
prepareClientServerRandom(msg);
NamedGroup usedGroup = chooser.getSelectedNamedGroup();
LOGGER.debug("Used Group: " + usedGroup.name());
setComputationPrivateKey(msg, clientMode);
ECDomainParameters ecParams = getDomainParameters(chooser.getEcCurveType(), usedGroup);
if (clientMode) {
ECPoint clientPublicKey = ecParams.getG().multiply(msg.getComputations().getPrivateKey().getValue());
clientPublicKey = clientPublicKey.normalize();
if (clientPublicKey.getRawXCoord() != null && clientPublicKey.getRawYCoord() != null) {
msg.getComputations().setComputedPublicKeyX(clientPublicKey.getRawXCoord().toBigInteger());
msg.getComputations().setComputedPublicKeyY(clientPublicKey.getRawYCoord().toBigInteger());
} else {
LOGGER.warn("Could not compute correct public key. Using empty one instead");
msg.getComputations().setComputedPublicKeyX(BigInteger.ZERO);
msg.getComputations().setComputedPublicKeyY(BigInteger.ZERO);
}
}
setComputationPublicKey(msg, clientMode);
LOGGER.debug("PublicKey used:" + msg.getComputations().getPublicKey().toString());
LOGGER.debug("PrivateKey used:" + msg.getComputations().getPrivateKey().getValue());
ECPoint publicKey = ecParams.getCurve().createPoint(msg.getComputations().getPublicKey().getX(),
msg.getComputations().getPublicKey().getY());
publicKey = publicKey.normalize();
premasterSecret = computePremasterSecret(new ECPublicKeyParameters(publicKey, ecParams),
new ECPrivateKeyParameters(msg.getComputations().getPrivateKey().getValue(), ecParams));
preparePremasterSecret(msg);
}
代码示例来源:origin: RUB-NDS/TLS-Attacker
protected void adjustECParameter(ECDHEServerKeyExchangeMessage message) {
tlsContext.setSelectedGroup(NamedGroup.getNamedGroup(message.getNamedGroup().getValue()));
// TODO avoid BC tool
byte[] ecParams = ArrayConverter.concatenate(new byte[] { message.getGroupType().getValue() }, message
.getNamedGroup().getValue(), ArrayConverter.intToBytes(message.getPublicKeyLength().getValue(), 1),
message.getPublicKey().getValue());
InputStream is = new ByteArrayInputStream(ecParams);
ECPublicKeyParameters publicKeyParameters = null;
try {
publicKeyParameters = ECCUtilsBCWrapper.readECParametersWithPublicKey(is);
} catch (TlsFatalAlert alert) {
throw new AdjustmentException("Problematic EC parameters, we dont support these yet", alert);
} catch (IOException ex) {
throw new AdjustmentException("EC public key parsing failed", ex);
}
CustomECPoint publicKey = new CustomECPoint(publicKeyParameters.getQ().getRawXCoord().toBigInteger(),
publicKeyParameters.getQ().getRawYCoord().toBigInteger());
tlsContext.setServerEcPublicKey(publicKey);
}
}
内容来源于网络,如有侵权,请联系作者删除!