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

x33g5p2x  于2022-01-19 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(113)

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

Extension.getInstance介绍

暂无

代码示例

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

/**
 * Constructor from ASN1Sequence.
 * <p>
 * The extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString)
 * </p>
 */
private Extensions(
  ASN1Sequence seq)
{
  Enumeration e = seq.getObjects();
  while (e.hasMoreElements())
  {
    Extension ext = Extension.getInstance(e.nextElement());
    extensions.put(ext.getExtnId(), ext);
    ordering.addElement(ext.getExtnId());
  }
}

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

public static CertEtcToken getInstance(Object obj)
{
  if (obj instanceof CertEtcToken)
  {
    return (CertEtcToken)obj;
  }
  else if (obj instanceof ASN1TaggedObject)
  {
    return new CertEtcToken((ASN1TaggedObject)obj);
  }
  else if (obj != null)
  {
    return new CertEtcToken(Extension.getInstance(obj));
  }
  return null;
}

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

public static CertEtcToken getInstance(Object obj)
{
  if (obj instanceof CertEtcToken)
  {
    return (CertEtcToken)obj;
  }
  else if (obj instanceof ASN1TaggedObject)
  {
    return new CertEtcToken((ASN1TaggedObject)obj);
  }
  else if (obj != null)
  {
    return new CertEtcToken(Extension.getInstance(obj));
  }
  return null;
}

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

/**
 * Constructor from ASN1Sequence.
 * <p>
 * The extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString)
 * </p>
 */
private Extensions(
  ASN1Sequence seq)
{
  Enumeration e = seq.getObjects();
  while (e.hasMoreElements())
  {
    Extension ext = Extension.getInstance(e.nextElement());
    if (extensions.containsKey(ext.getExtnId()))
    {
      throw new IllegalArgumentException("repeated extension found: " + ext.getExtnId());
    }
    
    extensions.put(ext.getExtnId(), ext);
    ordering.addElement(ext.getExtnId());
  }
}

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

private ExtensionReq(
  ASN1Sequence seq)
{
  this.extensions = new Extension[seq.size()];
  for (int i = 0; i != seq.size(); i++)
  {
    extensions[i] = Extension.getInstance(seq.getObjectAt(i));
  }
}

代码示例来源:origin: kaikramer/keystore-explorer

/**
 * Creates an X509ExtensionSet object from the extensions in the ASN1 sequence.
 *
 * @param extensions Sequence with extensions.
 */
public X509ExtensionSet(ASN1Sequence extensions) {
  ASN1Encodable[] asn1Encodables = extensions.toArray();
  for (int i = 0; i < asn1Encodables.length; i++) {
    ASN1Encodable asn1Encodable = asn1Encodables[i];
    Extension ext = Extension.getInstance(asn1Encodable);
    if (ext != null) {
      try {
        addExtension(ext.getExtnId().toString(), ext.isCritical(), ext.getExtnValue().getEncoded());
      } catch (IOException e) {
        // ignore exception from getEncoded()
      }
    }
  }
}

相关文章