org.bouncycastle.asn1.ASN1Integer.getPositiveValue()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(36)

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

ASN1Integer.getPositiveValue介绍

[英]in some cases positive values get crammed into a space, that's not quite big enough...
[中]在某些情况下,正值被塞进空间,空间不够大。。。

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

private BigInteger getCrlNumber(X509CRL crl) {
  byte[] crlNumberExtensionValue = crl.getExtensionValue(Extension.cRLNumber.getId());
  if (null == crlNumberExtensionValue) {
    return null;
  }
  try {
    ASN1InputStream asn1IS1 = null, asn1IS2 = null;
    try {
      asn1IS1 = new ASN1InputStream(crlNumberExtensionValue);
      ASN1OctetString octetString = (ASN1OctetString)asn1IS1.readObject();
      byte[] octets = octetString.getOctets();
      asn1IS2 = new ASN1InputStream(octets);
      ASN1Integer integer = (ASN1Integer)asn1IS2.readObject();
      return integer.getPositiveValue();
    } finally {
      IOUtils.closeQuietly(asn1IS2);
      IOUtils.closeQuietly(asn1IS1);
    }
  } catch (IOException e) {
    throw new RuntimeException("I/O error: " + e.getMessage(), e);
  }
}

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

/**
 * Return the generator of the multiplicative subgroup of order g.
 *
 * @return the generator g.
 */
public BigInteger getG()
{
  return this.g.getPositiveValue();
}

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

public BigInteger getL()
{
  if (l == null)
  {
    return null;
  }
  return l.getPositiveValue();
}

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

/**
 * Return the public value Y for the key.
 *
 * @return the Y value.
 */
public BigInteger getY()
{
  return this.y.getPositiveValue();
}

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

/**
 * Return the prime p defining the Galois field.
 *
 * @return the prime p.
 */
public BigInteger getP()
{
  return this.p.getPositiveValue();
}

代码示例来源:origin: redfish64/TinyTravelTracker

public BigInteger getL()
{
  if (l == null)
  {
    return null;
  }
  return l.getPositiveValue();
}

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

public BigInteger getP()
{
  return p.getPositiveValue();
}

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

public BigInteger getP()
{
  return p.getPositiveValue();
}

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

public BigInteger getP()
{
  return p.getPositiveValue();
}

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

public BigInteger getP()
{
  return p.getPositiveValue();
}

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

/**
 * Return q, the prime factor of p - 1
 *
 * @return q value
 */
public BigInteger getQ()
{
  return this.q.getPositiveValue();
}

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

public BigInteger getG()
{
  return g.getPositiveValue();
}

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

public BigInteger getG()
{
  return g.getPositiveValue();
}

代码示例来源:origin: redfish64/TinyTravelTracker

private RSAPublicKey(
  ASN1Sequence seq)
{
  if (seq.size() != 2)
  {
    throw new IllegalArgumentException("Bad sequence size: "
        + seq.size());
  }
  Enumeration e = seq.getObjects();
  modulus = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
  publicExponent = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
}

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

private RSAPublicKey(
  ASN1Sequence seq)
{
  if (seq.size() != 2)
  {
    throw new IllegalArgumentException("Bad sequence size: "
        + seq.size());
  }
  Enumeration e = seq.getObjects();
  modulus = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
  publicExponent = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
}

代码示例来源:origin: redfish64/TinyTravelTracker

public RSAPublicKeyStructure(
  ASN1Sequence  seq)
{
  if (seq.size() != 2)
  {
    throw new IllegalArgumentException("Bad sequence size: "
        + seq.size());
  }
  Enumeration e = seq.getObjects();
  modulus = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
  publicExponent = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
}

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

public RSAPublicKeyStructure(
  ASN1Sequence  seq)
{
  if (seq.size() != 2)
  {
    throw new IllegalArgumentException("Bad sequence size: "
        + seq.size());
  }
  Enumeration e = seq.getObjects();
  modulus = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
  publicExponent = ASN1Integer.getInstance(e.nextElement()).getPositiveValue();
}

代码示例来源:origin: org.xipki/security

public static byte[] dsaSigX962ToPlain(byte[] x962Signature, int keyBitLen)
  throws XiSecurityException {
 Args.notNull(x962Signature, "x962Signature");
 ASN1Sequence seq = ASN1Sequence.getInstance(x962Signature);
 if (seq.size() != 2) {
  throw new IllegalArgumentException("invalid X962Signature");
 }
 BigInteger sigR = ASN1Integer.getInstance(seq.getObjectAt(0)).getPositiveValue();
 BigInteger sigS = ASN1Integer.getInstance(seq.getObjectAt(1)).getPositiveValue();
 return dsaSigToPlain(sigR, sigS, keyBitLen);
}

代码示例来源:origin: org.xipki.tk/security

public static byte[] convertX962DSASigToPlain(final byte[] x962Signature, final int keyBitLen)
    throws XiSecurityException {
  ParamUtil.requireNonNull("x962Signature", x962Signature);
  ASN1Sequence seq = ASN1Sequence.getInstance(x962Signature);
  if (seq.size() != 2) {
    throw new IllegalArgumentException("invalid X962Signature");
  }
  BigInteger sigR = ASN1Integer.getInstance(seq.getObjectAt(0)).getPositiveValue();
  BigInteger sigS = ASN1Integer.getInstance(seq.getObjectAt(1)).getPositiveValue();
  return convertDSASigToPlain(sigR, sigS, keyBitLen);
}

代码示例来源:origin: com.bushidowallet/bushido-core-lib

public boolean verify(byte[] message, byte[] signature) throws Exception
{
  ASN1InputStream asn1 = new ASN1InputStream(signature);
  ECDSASigner signer = new ECDSASigner();
  //not for signing...
  signer.init(false, new ECPublicKeyParameters(curve.getCurve().decodePoint(pub), params));
  DLSequence seq = (DLSequence) asn1.readObject();
  BigInteger r = ((ASN1Integer) seq.getObjectAt(0)).getPositiveValue();
  BigInteger s = ((ASN1Integer) seq.getObjectAt(1)).getPositiveValue();
  return signer.verifySignature(message, r, s);
}

相关文章