本文整理了Java中org.spongycastle.math.ec.ECCurve.getFieldSize()
方法的一些代码示例,展示了ECCurve.getFieldSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ECCurve.getFieldSize()
方法的具体详情如下:
包路径:org.spongycastle.math.ec.ECCurve
类名称:ECCurve
方法名:getFieldSize
暂无
代码示例来源:origin: ethereum/ethereumj
public static byte[] decrypt(BigInteger privKey, byte[] cipher, byte[] macData) throws IOException, InvalidCipherTextException {
byte[] plaintext;
ByteArrayInputStream is = new ByteArrayInputStream(cipher);
byte[] ephemBytes = new byte[2*((CURVE.getCurve().getFieldSize()+7)/8) + 1];
is.read(ephemBytes);
ECPoint ephem = CURVE.getCurve().decodePoint(ephemBytes);
byte[] IV = new byte[KEY_SIZE /8];
is.read(IV);
byte[] cipherBody = new byte[is.available()];
is.read(cipherBody);
plaintext = decrypt(ephem, privKey, IV, cipherBody, macData);
return plaintext;
}
代码示例来源:origin: ethereum/ethereumj
public static byte[] decrypt(BigInteger prv, byte[] cipher) throws InvalidCipherTextException, IOException {
ByteArrayInputStream is = new ByteArrayInputStream(cipher);
byte[] ephemBytes = new byte[2*((curve.getCurve().getFieldSize()+7)/8) + 1];
is.read(ephemBytes);
ECPoint ephem = curve.getCurve().decodePoint(ephemBytes);
byte[] IV = new byte[KEY_SIZE /8];
is.read(IV);
byte[] cipherBody = new byte[is.available()];
is.read(cipherBody);
EthereumIESEngine iesEngine = makeIESEngine(false, ephem, prv, IV);
byte[] message = iesEngine.processBlock(cipherBody, 0, cipherBody.length);
return message;
}
代码示例来源:origin: com.madgag.spongycastle/core
/**
* Return the curve's field size in bytes.
*
* @param c the curve of interest.
* @return the field size in bytes (rounded up).
*/
public int getByteLength(
ECCurve c)
{
return (c.getFieldSize() + 7) / 8;
}
代码示例来源:origin: com.madgag/sc-light-jdk15on
public int getByteLength(
ECCurve c)
{
return (c.getFieldSize() + 7) / 8;
}
代码示例来源:origin: com.madgag.spongycastle/core
public static int getCombSize(ECCurve c)
{
BigInteger order = c.getOrder();
return order == null ? c.getFieldSize() + 1 : order.bitLength();
}
代码示例来源:origin: com.madgag.spongycastle/core
public int getSeedLen()
{
return p.getCurve().getFieldSize();
}
代码示例来源:origin: com.madgag.spongycastle/prov
public int engineGetKeySize(Key key)
{
if (key instanceof ECKey)
{
return ((ECKey)key).getParameters().getCurve().getFieldSize();
}
else
{
throw new IllegalArgumentException("not an EC key");
}
}
代码示例来源:origin: com.madgag.spongycastle/core
public int getMaxOutlen()
{
return ((p.getCurve().getFieldSize() - (13 + log2(cofactor))) / 8) * 8;
}
代码示例来源:origin: com.madgag.spongycastle/core
public int getFieldSize()
{
return (key.getParameters().getCurve().getFieldSize() + 7) / 8;
}
代码示例来源:origin: com.madgag.spongycastle/core
public int getFieldSize()
{
return (key.getParameters().getCurve().getFieldSize() + 7) / 8;
}
代码示例来源:origin: com.madgag.spongycastle/core
public int getFieldSize()
{
return (key.getParameters().getCurve().getFieldSize() + 7) / 8;
}
代码示例来源:origin: com.madgag.spongycastle/core
public int getFieldSize()
{
return (staticKey.getParameters().getCurve().getFieldSize() + 7) / 8;
}
代码示例来源:origin: com.madgag.spongycastle/core
private static ECFieldElement hash2FieldElement(ECCurve curve, byte[] hash)
{
byte[] data = Arrays.reverse(hash);
return curve.fromBigInteger(truncate(new BigInteger(1, data), curve.getFieldSize()));
}
代码示例来源:origin: biheBlockChain/wkcwallet-java
public static byte[] decrypt(BigInteger privKey, byte[] cipher, byte[] macData) throws IOException, InvalidCipherTextException {
byte[] plaintext;
ByteArrayInputStream is = new ByteArrayInputStream(cipher);
byte[] ephemBytes = new byte[2*((CURVE.getCurve().getFieldSize()+7)/8) + 1];
is.read(ephemBytes);
ECPoint ephem = CURVE.getCurve().decodePoint(ephemBytes);
byte[] IV = new byte[KEY_SIZE /8];
is.read(IV);
byte[] cipherBody = new byte[is.available()];
is.read(cipherBody);
plaintext = decrypt(ephem, privKey, IV, cipherBody, macData);
return plaintext;
}
代码示例来源:origin: yggdrash/yggdrash
public static byte[] decrypt(BigInteger privKey, byte[] cipher, byte[] macData) throws IOException, InvalidCipherTextException {
byte[] plaintext;
ByteArrayInputStream is = new ByteArrayInputStream(cipher);
byte[] ephemBytes = new byte[2 * ((CURVE.getCurve().getFieldSize() + 7) / 8) + 1];
is.read(ephemBytes);
ECPoint ephem = CURVE.getCurve().decodePoint(ephemBytes);
byte[] IV = new byte[KEY_SIZE / 8];
is.read(IV);
byte[] cipherBody = new byte[is.available()];
is.read(cipherBody);
plaintext = decrypt(ephem, privKey, IV, cipherBody, macData);
return plaintext;
}
代码示例来源:origin: com.madgag.spongycastle/core
V = new byte[1 + (ecParams.getCurve().getFieldSize()+7)/8];
break;
case 0x06: // hybrid
case 0x07: // Byte length calculated as in ECPoint.getEncoded();
V = new byte[1 + 2*((ecParams.getCurve().getFieldSize()+7)/8)];
break;
代码示例来源:origin: com.madgag.spongycastle/core
public int getFieldSize()
{
return (privParams.getStaticPrivateKey().getParameters().getCurve().getFieldSize() + 7) / 8;
}
代码示例来源:origin: yggdrash/yggdrash
private static byte[] decrypt(BigInteger prv, byte[] cipher) throws InvalidCipherTextException, IOException {
ByteArrayInputStream is = new ByteArrayInputStream(cipher);
byte[] ephemBytes = new byte[2 * ((curve.getCurve().getFieldSize() + 7) / 8) + 1];
is.read(ephemBytes);
ECPoint ephem = curve.getCurve().decodePoint(ephemBytes);
byte[] IV = new byte[KEY_SIZE / 8];
is.read(IV);
byte[] cipherBody = new byte[is.available()];
is.read(cipherBody);
EthereumIESEngine iesEngine = makeIESEngine(false, ephem, prv, IV);
return iesEngine.processBlock(cipherBody, 0, cipherBody.length);
}
代码示例来源:origin: com.madgag.spongycastle/core
public void init(
CipherParameters privParam)
{
SM2KeyExchangePrivateParameters baseParam;
if (privParam instanceof ParametersWithID)
{
baseParam = (SM2KeyExchangePrivateParameters)((ParametersWithID)privParam).getParameters();
userID = ((ParametersWithID)privParam).getID();
}
else
{
baseParam = (SM2KeyExchangePrivateParameters)privParam;
userID = new byte[0];
}
initiator = baseParam.isInitiator();
staticKey = baseParam.getStaticPrivateKey();
ephemeralKey = baseParam.getEphemeralPrivateKey();
ecParams = staticKey.getParameters();
staticPubPoint = baseParam.getStaticPublicPoint();
ephemeralPubPoint = baseParam.getEphemeralPublicPoint();
curveLength = (ecParams.getCurve().getFieldSize() + 7) / 8;
w = ecParams.getCurve().getFieldSize() / 2 - 1;
}
代码示例来源:origin: com.madgag.spongycastle/core
public void init(boolean forEncryption, CipherParameters param)
{
this.forEncryption = forEncryption;
if (forEncryption)
{
ParametersWithRandom rParam = (ParametersWithRandom)param;
ecKey = (ECKeyParameters)rParam.getParameters();
ecParams = ecKey.getParameters();
ECPoint s = ((ECPublicKeyParameters)ecKey).getQ().multiply(ecParams.getH());
if (s.isInfinity())
{
throw new IllegalArgumentException("invalid key: [h]Q at infinity");
}
random = rParam.getRandom();
}
else
{
ecKey = (ECKeyParameters)param;
ecParams = ecKey.getParameters();
}
curveLength = (ecParams.getCurve().getFieldSize() + 7) / 8;
}
内容来源于网络,如有侵权,请联系作者删除!