org.bouncycastle.asn1.x9.X9IntegerConverter.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中org.bouncycastle.asn1.x9.X9IntegerConverter.<init>()方法的一些代码示例,展示了X9IntegerConverter.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X9IntegerConverter.<init>()方法的具体详情如下:
包路径:org.bouncycastle.asn1.x9.X9IntegerConverter
类名称:X9IntegerConverter
方法名:<init>

X9IntegerConverter.<init>介绍

暂无

代码示例

代码示例来源:origin: web3j/web3j

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: io.github.moacchain/crypto

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: org.nervos/crypto

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: org.web3j/crypto

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: io.daonomic.scalether/util

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: org.medibloc.panacea/crypto

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(Keys.CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return Keys.CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: com.cryptape.cita/crypto

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: FISCO-BCOS/web3sdk

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: kframework/k

/** Decompress a compressed public key (x co-ord and low-bit of y-coord). */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte)(yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: neow3j/neow3j

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).<br/>
 * Based on: https://tools.ietf.org/html/rfc5480#section-2.2
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(NeoConstants.CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return NeoConstants.CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: CryptoKass/dilithium

/**
 * Decompress a compressed public key (x co-ord and low-bit of y-coord).
 *
 * @param xBN -
 * @param yBit -
 * @return -
 */
private static ECPoint decompressKey(BigInteger xBN, boolean yBit) {
  X9IntegerConverter x9 = new X9IntegerConverter();
  byte[] compEnc = x9.integerToBytes(xBN, 1 + x9.getByteLength(CURVE.getCurve()));
  compEnc[0] = (byte) (yBit ? 0x03 : 0x02);
  return CURVE.getCurve().decodePoint(compEnc);
}

代码示例来源:origin: BMF-RKSV-Technik/at-registrierkassen-mustercode

/**
 * Helper method to convert DER-encoded signature values (e.g. used by Java)
 * to concatenated signature values
 * (as used by the JWS-standard)
 *
 * @param derEncodedSignatureValue
 *          DER-encoded signature value
 * @return concatenated signature value (as used by JWS standard)
 * @throws IOException
 */
public static byte[] convertDEREncodedSignatureToJWSConcatenated(final byte[] derEncodedSignatureValue)
  throws IOException {
 final ASN1InputStream asn1InputStream = new ASN1InputStream(derEncodedSignatureValue);
 final ASN1Primitive asn1Primitive = asn1InputStream.readObject();
 asn1InputStream.close();
 final ASN1Sequence asn1Sequence = (ASN1Sequence.getInstance(asn1Primitive));
 final ASN1Integer rASN1 = (ASN1Integer) asn1Sequence.getObjectAt(0);
 final ASN1Integer sASN1 = (ASN1Integer) asn1Sequence.getObjectAt(1);
 final X9IntegerConverter x9IntegerConverter = new X9IntegerConverter();
 final byte[] r = x9IntegerConverter.integerToBytes(rASN1.getValue(), 32);
 final byte[] s = x9IntegerConverter.integerToBytes(sASN1.getValue(), 32);
 final byte[] concatenatedSignatureValue = new byte[64];
 System.arraycopy(r, 0, concatenatedSignatureValue, 0, 32);
 System.arraycopy(s, 0, concatenatedSignatureValue, 32, 32);
 return concatenatedSignatureValue;
}

代码示例来源:origin: ZuInnoTe/hadoopcryptoledger

X9IntegerConverter x9 = new X9IntegerConverter();
byte[] compEnc = x9.integerToBytes(x, 1 + x9.getByteLength(CURVE.getCurve()));
boolean yBit=(receiverId & 1) == 1;

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

private void populateFromPubKeyInfo(SubjectPublicKeyInfo info)
{
  X962Parameters params = X962Parameters.getInstance(info.getAlgorithm().getParameters());
  ECCurve curve = EC5Util.getCurve(configuration, params);
  ecSpec = EC5Util.convertToSpec(params, curve);
  DERBitString    bits = info.getPublicKeyData();
  byte[]          data = bits.getBytes();
  ASN1OctetString key = new DEROctetString(data);
  //
  // extra octet string - one of our old certs...
  //
  if (data[0] == 0x04 && data[1] == data.length - 2
    && (data[2] == 0x02 || data[2] == 0x03))
  {
    int qLength = new X9IntegerConverter().getByteLength(curve);
    if (qLength >= data.length - 3)
    {
      try
      {
        key = (ASN1OctetString) ASN1Primitive.fromByteArray(data);
      }
      catch (IOException ex)
      {
        throw new IllegalArgumentException("error recovering public key");
      }
    }
  }
  X9ECPoint derQ = new X9ECPoint(curve, key);
  this.ecPublicKey = new ECPublicKeyParameters(derQ.getPoint(), ECUtil.getDomainParameters(configuration, params));
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

&& (data[2] == 0x02 || data[2] == 0x03))
int qLength = new X9IntegerConverter().getByteLength(dParams.getCurve());

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

&& (data[2] == 0x02 || data[2] == 0x03))
int qLength = new X9IntegerConverter().getByteLength(curve);

相关文章

微信公众号

最新文章

更多