org.bouncycastle.asn1.x509.X509Extension.getValue()方法的使用及代码示例

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

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

X509Extension.getValue介绍

暂无

代码示例

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

public int hashCode()
{
  if (this.isCritical())
  {
    return this.getValue().hashCode();
  }
  return ~this.getValue().hashCode();
}

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

public int hashCode()
{
  if (this.isCritical())
  {
    return this.getValue().hashCode();
  }
  return ~this.getValue().hashCode();
}

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

public boolean equals(
  Object  o)
{
  if (!(o instanceof X509Extension))
  {
    return false;
  }
  X509Extension   other = (X509Extension)o;
  return other.getValue().equals(this.getValue())
    && (other.isCritical() == this.isCritical());
}

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

public boolean equals(
  Object  o)
{
  if (!(o instanceof X509Extension))
  {
    return false;
  }
  X509Extension   other = (X509Extension)o;
  return other.getValue().equals(this.getValue())
    && (other.isCritical() == this.isCritical());
}

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

/**
   * Convert the value of the passed in extension to an object
   * @param ext the extension to parse
   * @return the object the value string contains
   * @exception IllegalArgumentException if conversion is not possible
   */
  public static ASN1Primitive convertValueToObject(
    X509Extension ext)
    throws IllegalArgumentException
  {
    try
    {
      return ASN1Primitive.fromByteArray(ext.getValue().getOctets());
    }
    catch (IOException e)
    {
      throw new IllegalArgumentException("can't convert extension: " +  e);
    }
  }
}

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

/**
   * Convert the value of the passed in extension to an object
   * @param ext the extension to parse
   * @return the object the value string contains
   * @exception IllegalArgumentException if conversion is not possible
   */
  public static ASN1Primitive convertValueToObject(
    X509Extension ext)
    throws IllegalArgumentException
  {
    try
    {
      return ASN1Primitive.fromByteArray(ext.getValue().getOctets());
    }
    catch (IOException e)
    {
      throw new IllegalArgumentException("can't convert extension: " +  e);
    }
  }
}

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

/**
 * <pre>
 *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
 *
 *     Extension         ::=   SEQUENCE {
 *        extnId            EXTENSION.&amp;id ({ExtensionSet}),
 *        critical          BOOLEAN DEFAULT FALSE,
 *        extnValue         OCTET STRING }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
  ASN1EncodableVector     vec = new ASN1EncodableVector();
  Enumeration             e = ordering.elements();
  while (e.hasMoreElements())
  {
    ASN1ObjectIdentifier    oid = (ASN1ObjectIdentifier)e.nextElement();
    X509Extension           ext = (X509Extension)extensions.get(oid);
    ASN1EncodableVector     v = new ASN1EncodableVector();
    v.add(oid);
    if (ext.isCritical())
    {
      v.add(ASN1Boolean.TRUE);
    }
    v.add(ext.getValue());
    vec.add(new DERSequence(v));
  }
  return new DERSequence(vec);
}

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

/**
 * <pre>
 *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
 *
 *     Extension         ::=   SEQUENCE {
 *        extnId            EXTENSION.&amp;id ({ExtensionSet}),
 *        critical          BOOLEAN DEFAULT FALSE,
 *        extnValue         OCTET STRING }
 * </pre>
 */
public ASN1Primitive toASN1Primitive()
{
  ASN1EncodableVector     vec = new ASN1EncodableVector();
  Enumeration             e = ordering.elements();
  while (e.hasMoreElements())
  {
    ASN1ObjectIdentifier    oid = (ASN1ObjectIdentifier)e.nextElement();
    X509Extension           ext = (X509Extension)extensions.get(oid);
    ASN1EncodableVector     v = new ASN1EncodableVector();
    v.add(oid);
    if (ext.isCritical())
    {
      v.add(ASN1Boolean.TRUE);
    }
    v.add(ext.getValue());
    vec.add(new DERSequence(v));
  }
  return new DERSequence(vec);
}

代码示例来源:origin: open-eid/digidoc4j

ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)o;
X509Extension extVal = ext.getExtension(oid);
ASN1OctetString oct = extVal.getValue();
ASN1InputStream extIn = new ASN1InputStream(new ByteArrayInputStream(oct.getOctets()));

相关文章

微信公众号

最新文章

更多