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

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

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

ASN1OctetString.getEncoded介绍

暂无

代码示例

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

public byte[] getExtensionValue(String oid)
{
  Extension ext = getExtension(new ASN1ObjectIdentifier(oid));
  if (ext != null)
  {
    try
    {
      return ext.getExtnValue().getEncoded();
    }
    catch (Exception e)
    {
      throw new RuntimeException("error encoding " + e.toString());
    }
  }
  return null;
}

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

public byte[] getExtensionValue(String oid)
{
  Extension ext = getExtension(new ASN1ObjectIdentifier(oid));
  if (ext != null)
  {
    try
    {
      return ext.getExtnValue().getEncoded();
    }
    catch (Exception e)
    {
      throw new IllegalStateException("Exception encoding: " + e.toString());
    }
  }
  return null;
}

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

public byte[] getExtensionValue(String oid) 
{
  Extensions extensions = cert.getAcinfo().getExtensions();
  if (extensions != null)
  {
    Extension ext = extensions.getExtension(new ASN1ObjectIdentifier(oid));
    if (ext != null)
    {
      try
      {
        return ext.getExtnValue().getEncoded(ASN1Encoding.DER);
      }
      catch (Exception e)
      {
        throw new RuntimeException("error encoding " + e.toString());
      }
    }
  }
  return null;
}

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

public byte[] getExtensionValue(String oid) 
{
  Extensions exts = c.getTBSCertificate().getExtensions();
  if (exts != null)
  {
    Extension   ext = exts.getExtension(new ASN1ObjectIdentifier(oid));
    if (ext != null)
    {
      try
      {
        return ext.getExtnValue().getEncoded();
      }
      catch (Exception e)
      {
        throw new IllegalStateException("error parsing " + e.toString());
      }
    }
  }
  return null;
}

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

public byte[] getExtensionValue(String oid)
{
  Extensions exts = c.getTBSCertList().getExtensions();
  if (exts != null)
  {
    Extension ext = exts.getExtension(new ASN1ObjectIdentifier(oid));
    if (ext != null)
    {
      try
      {
        return ext.getExtnValue().getEncoded();
      }
      catch (Exception e)
      {
        throw new IllegalStateException("error parsing " + e.toString());
      }
    }
  }
  return null;
}

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

public byte[] getExtensionValue(String oid) 
{
  Extensions exts = c.getTBSCertificate().getExtensions();
  if (exts != null)
  {
    Extension   ext = exts.getExtension(new ASN1ObjectIdentifier(oid));
    if (ext != null)
    {
      try
      {
        return ext.getExtnValue().getEncoded();
      }
      catch (Exception e)
      {
        throw new IllegalStateException("error parsing " + e.toString());
      }
    }
  }
  return null;
}

代码示例来源:origin: eu.eu-emi.security/canl

public static byte[] extractNonce(OCSPReq request) throws IOException
  {
    Extension nonceExt = request.getExtension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce);
    if (nonceExt == null)
      return null;
    byte[] nonceAsn = nonceExt.getExtnValue().getEncoded();
    if (nonceAsn == null)
      return null;
    ASN1OctetString octs;
    try
    {
      octs = (ASN1OctetString)ASN1Primitive.fromByteArray(nonceAsn);
    } catch (Exception e)
    {
      throw new IllegalStateException("Can't decode nonce encoded in request", e);
    }
    return octs.getOctets();			
  }
}

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

public byte[] getExtensionValue(String oid)
{
  Extensions exts = c.getTBSCertList().getExtensions();
  if (exts != null)
  {
    Extension ext = exts.getExtension(new ASN1ObjectIdentifier(oid));
    if (ext != null)
    {
      try
      {
        return ext.getExtnValue().getEncoded();
      }
      catch (Exception e)
      {
        throw new IllegalStateException("error parsing " + e.toString());
      }
    }
  }
  return null;
}

代码示例来源: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()
      }
    }
  }
}

代码示例来源:origin: eu.eu-emi.security/canl

getExtnValue().getEncoded();
} catch (IOException e1)

相关文章