org.bouncycastle.asn1.x509.X509Extensions类的使用及代码示例

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

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

X509Extensions介绍

暂无

代码示例

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

public static X509Extensions getInstance(
  Object  obj)
{
  if (obj == null || obj instanceof X509Extensions)
  {
    return (X509Extensions)obj;
  }
  if (obj instanceof ASN1Sequence)
  {
    return new X509Extensions((ASN1Sequence)obj);
  }
  if (obj instanceof Extensions)
  {
    return new X509Extensions((ASN1Sequence)((Extensions)obj).toASN1Primitive());
  }
  if (obj instanceof ASN1TaggedObject)
  {
    return getInstance(((ASN1TaggedObject)obj).getObject());
  }
  throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
}

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

public ASN1ObjectIdentifier[] getCriticalExtensionOIDs()
{
  return getExtensionOIDs(true);
}

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

/**
 * @deprecated use method taking Extensions
 * @param certDetails
 * @param crlEntryDetails
 */
public RevDetails(CertTemplate certDetails, X509Extensions crlEntryDetails)
{
  this.certDetails = certDetails;
  this.crlEntryDetails = Extensions.getInstance(crlEntryDetails.toASN1Primitive());
}

代码示例来源:origin: org.codeartisans.qipki/qipki-crypto

DEREncodable extensionsDEREncodable = attributeValues.getObjectAt( 0 );
      ASN1Sequence extensionsASN1Sequence = ( ASN1Sequence ) extensionsDEREncodable;
      requestedExtensions = new X509Extensions( extensionsASN1Sequence );
Enumeration<?> e = requestedExtensions.oids();
while ( e.hasMoreElements() ) {
  DERObjectIdentifier oid = ( DERObjectIdentifier ) e.nextElement();
  X509Extension extension = requestedExtensions.getExtension( oid );
  extractedExtensions.add( new X509ExtensionHolder( oid, extension.isCritical(), X509Extension.convertValueToObject( extension ) ) );

代码示例来源:origin: net.jradius/jradius-extended

private void validateKeyUsage(X509CertificateStructure c, int keyUsageBits) throws IOException
{
  X509Extensions exts = c.getTBSCertificate().getExtensions();
  if (exts != null)
  {
    X509Extension ext = exts.getExtension(X509Extensions.KeyUsage);
    if (ext != null)
    {
      DERBitString ku = KeyUsage.getInstance(ext);
      int bits = ku.getBytes()[0] & 0xff;
      if ((bits & keyUsageBits) != keyUsageBits)
      {
        handler.failWithError(TlsProtocolHandler.AL_fatal,
          TlsProtocolHandler.AP_certificate_unknown);
      }
    }
  }
}

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

/**
   * Generate an X509Extensions object based on the current state of the generator.
   *
   * @return  an X09Extensions object.
   */
  public X509Extensions generate()
  {
    return new X509Extensions(extOrdering, extensions);
  }
}

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

X509Extensions ext = tbsCert.getExtensions();
if (ext != null) {
  Enumeration en = ext.oids();
  while (en.hasMoreElements()) {
    Object o = en.nextElement();
    if(o instanceof ASN1ObjectIdentifier) {
      ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)o;
      X509Extension extVal = ext.getExtension(oid);
      ASN1OctetString oct = extVal.getValue();
      ASN1InputStream extIn = new ASN1InputStream(new ByteArrayInputStream(oct.getOctets()));

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

public static X509Extensions getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(ASN1Sequence.getInstance(obj, explicit));
}

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

public ASN1ObjectIdentifier[] getExtensionOIDs()
{
  return toOidArray(ordering);
}

代码示例来源:origin: com.hynnet/jradius-extended

private void validateKeyUsage(X509CertificateStructure c, int keyUsageBits) throws IOException
{
  X509Extensions exts = c.getTBSCertificate().getExtensions();
  if (exts != null)
  {
    X509Extension ext = exts.getExtension(X509Extensions.KeyUsage);
    if (ext != null)
    {
      DERBitString ku = KeyUsage.getInstance(ext);
      int bits = ku.getBytes()[0] & 0xff;
      if ((bits & keyUsageBits) != keyUsageBits)
      {
        handler.failWithError(TlsProtocolHandler.AL_fatal,
          TlsProtocolHandler.AP_certificate_unknown);
      }
    }
  }
}

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

/**
   * Generate an X509Extensions object based on the current state of the generator.
   *
   * @return  an X09Extensions object.
   */
  public X509Extensions generate()
  {
    return new X509Extensions(extOrdering, extensions);
  }
}

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

public static X509Extensions getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(ASN1Sequence.getInstance(obj, explicit));
}

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

public ASN1ObjectIdentifier[] getExtensionOIDs()
{
  return toOidArray(ordering);
}

代码示例来源:origin: com.hynnet/jradius-extended

private void validateKeyUsage(X509CertificateStructure c, int keyUsageBits) throws IOException
{
  X509Extensions exts = c.getTBSCertificate().getExtensions();
  if (exts != null)
  {
    X509Extension ext = exts.getExtension(X509Extensions.KeyUsage);
    if (ext != null)
    {
      DERBitString ku = KeyUsage.getInstance(ext);
      int bits = ku.getBytes()[0] & 0xff;
      if ((bits & keyUsageBits) != keyUsageBits)
      {
        handler.failWithError(TlsProtocolHandler.AL_fatal,
          TlsProtocolHandler.AP_certificate_unknown);
      }
    }
  }
}

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

public static X509Extensions getInstance(
  Object  obj)
{
  if (obj == null || obj instanceof X509Extensions)
  {
    return (X509Extensions)obj;
  }
  if (obj instanceof ASN1Sequence)
  {
    return new X509Extensions((ASN1Sequence)obj);
  }
  if (obj instanceof Extensions)
  {
    return new X509Extensions((ASN1Sequence)((Extensions)obj).toASN1Primitive());
  }
  if (obj instanceof ASN1TaggedObject)
  {
    return getInstance(((ASN1TaggedObject)obj).getObject());
  }
  throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
}

代码示例来源:origin: org.codeartisans.qipki/qipki-crypto

@SuppressWarnings( { "UseOfObsoleteCollectionType", "unchecked" } )
private DERSet generateSANAttribute( GeneralNames subGeneralNames )
{
  if ( subGeneralNames == null ) {
    return new DERSet();
  }
  Vector oids = new Vector();
  Vector values = new Vector();
  oids.add( X509Extensions.SubjectAlternativeName );
  values.add( new X509Extension( false, new DEROctetString( subGeneralNames ) ) );
  X509Extensions extensions = new X509Extensions( oids, values );
  Attribute attribute = new Attribute( PKCSObjectIdentifiers.pkcs_9_at_extensionRequest, new DERSet( extensions ) );
  return new DERSet( attribute );
}

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

public ASN1ObjectIdentifier[] getCriticalExtensionOIDs()
{
  return getExtensionOIDs(true);
}

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

break;
case 3:
  extensions = X509Extensions.getInstance(extra);

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

private ASN1ObjectIdentifier[] getExtensionOIDs(boolean isCritical)
{
  Vector oidVec = new Vector();
  for (int i = 0; i != ordering.size(); i++)
  {
    Object oid = ordering.elementAt(i);
    if (((X509Extension)extensions.get(oid)).isCritical() == isCritical)
    {
      oidVec.addElement(oid);
    }
  }
  return toOidArray(oidVec);
}

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

/**
 * @deprecated use method taking Extensions
 * @param extensions
 */
public void setExtensions(
  X509Extensions    extensions)
{
  this.extensions = Extensions.getInstance(extensions.toASN1Primitive());
}

相关文章