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

x33g5p2x  于2022-01-16 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(83)

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

ASN1Set.getObjects介绍

暂无

代码示例

代码示例来源:origin: AndroidHardening/Auditor

public static Set<Integer> getIntegersFromAsn1Set(ASN1Encodable set)
    throws CertificateParsingException {
  if (!(set instanceof ASN1Set)) {
    throw new CertificateParsingException(
        "Expected set, found " + set.getClass().getName());
  }
  ImmutableSet.Builder<Integer> builder = ImmutableSet.builder();
  for (Enumeration<?> e = ((ASN1Set) set).getObjects(); e.hasMoreElements();) {
    builder.add(getIntegerFromAsn1((ASN1Integer) e.nextElement()));
  }
  return builder.build();
}

代码示例来源:origin: com.google.code.jscep/jscep-api

private Set<SignerInfo> getSignerSet(SignedData signedData) {
  final Set<SignerInfo> set = new HashSet<SignerInfo>();
  final Enumeration<?> signerInfos = signedData.getSignerInfos().getObjects();
  
  while (signerInfos.hasMoreElements()) {
    set.add(SignerInfo.getInstance(signerInfos.nextElement()));
  }
  
  return set;
}

代码示例来源:origin: horrorho/InflatableDonkey

static Set<ASN1Primitive> asPrimitiveSet(ASN1Encodable encodable) {
  Enumeration enumeration = as(ASN1Set.class, encodable).getObjects();
  Set<ASN1Primitive> set = new HashSet<>();
  while (enumeration.hasMoreElements()) {
    ASN1Encodable element = (ASN1Encodable) enumeration.nextElement();
    set.add(asPrimitive(element));
  }
  return set;
}

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

public int hashCode()
{
  Enumeration             e = this.getObjects();
  int                     hashCode = size();
  while (e.hasMoreElements())
  {
    Object o = getNext(e);
    hashCode *= 17;
    hashCode ^= o.hashCode();
  }
  return hashCode;
}

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

public int hashCode()
{
  Enumeration             e = this.getObjects();
  int                     hashCode = size();
  while (e.hasMoreElements())
  {
    Object o = getNext(e);
    hashCode *= 17;
    hashCode ^= o.hashCode();
  }
  return hashCode;
}

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

private boolean checkForVersion3(ASN1Set signerInfs)
{
  for (Enumeration e = signerInfs.getObjects(); e.hasMoreElements();)
  {
    SignerInfo s = SignerInfo.getInstance(e.nextElement());
    if (s.getVersion().getValue().intValue() == 3)
    {
      return true;
    }
  }
  return false;
}

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

private boolean checkForVersion3(ASN1Set signerInfs)
{
  for (Enumeration e = signerInfs.getObjects(); e.hasMoreElements();)
  {
    SignerInfo s = SignerInfo.getInstance(e.nextElement());
    if (s.getVersion().getValue().intValue() == 3)
    {
      return true;
    }
  }
  return false;
}

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

private String dumpSetOrSequence(ASN1Encodable asn1ConstructedType) throws Asn1Exception, IOException {
  StringBuilder sb = new StringBuilder();
  sb.append(indentSequence.toString(indentLevel));
  Enumeration<?> components;
  // Sequence or Set?
  if (asn1ConstructedType instanceof ASN1Sequence) {
    sb.append("SEQUENCE");
    ASN1Sequence sequence = (ASN1Sequence) asn1ConstructedType;
    components = sequence.getObjects();
  } else {
    // == SET
    sb.append("SET");
    ASN1Set set = (ASN1Set) asn1ConstructedType;
    components = set.getObjects();
  }
  sb.append(NEWLINE);
  sb.append(indentSequence.toString(indentLevel));
  sb.append("{");
  sb.append(NEWLINE);
  while (components.hasMoreElements()) {
    ASN1Primitive component = (ASN1Primitive) components.nextElement();
    sb.append(dump(component));
  }
  sb.append(indentSequence.toString(indentLevel));
  sb.append("}");
  sb.append(NEWLINE);
  return sb.toString();
}

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

public static int calculateVersion(OriginatorInfo originatorInfo, ASN1Set recipientInfos, ASN1Set unprotectedAttrs)
  {
    int version;

    if (originatorInfo != null || unprotectedAttrs != null)
    {
      version = 2;
    }
    else
    {
      version = 0;

      Enumeration e = recipientInfos.getObjects();

      while (e.hasMoreElements())
      {
        RecipientInfo   ri = RecipientInfo.getInstance(e.nextElement());

        if (ri.getVersion().getValue().intValue() != version)
        {
          version = 2;
          break;
        }
      }
    }

    return version;
  }
}

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

public static int calculateVersion(OriginatorInfo originatorInfo, ASN1Set recipientInfos, ASN1Set unprotectedAttrs)
  {
    int version;

    if (originatorInfo != null || unprotectedAttrs != null)
    {
      version = 2;
    }
    else
    {
      version = 0;

      Enumeration e = recipientInfos.getObjects();

      while (e.hasMoreElements())
      {
        RecipientInfo   ri = RecipientInfo.getInstance(e.nextElement());

        if (ri.getVersion().getValue().intValue() != version)
        {
          version = 2;
          break;
        }
      }
    }

    return version;
  }
}

代码示例来源:origin: com.google.code.jscep/jscep-api

final Enumeration<?> certEnum = certs.getObjects();
while (certEnum.hasMoreElements()) {
  ASN1Sequence o = (ASN1Sequence) certEnum.nextElement();
final Enumeration<?> crlEnum = crls.getObjects();
while (crlEnum.hasMoreElements()) {
  ASN1Sequence o = (ASN1Sequence) crlEnum.nextElement();

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

private static void validateAttributes(ASN1Set attributes)
  {
    if (attributes == null)
    {
      return;
    }

    for (Enumeration en = attributes.getObjects(); en.hasMoreElements();)
    {
      Attribute attr = Attribute.getInstance(en.nextElement());
      if (attr.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_challengePassword))
      {
        if (attr.getAttrValues().size() != 1)
        {
          throw new IllegalArgumentException("challengePassword attribute must have one value");
        }
      }
    }
  }
}

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

for (Enumeration e = origInfo.getCertificates().getObjects(); e.hasMoreElements();)
  for (Enumeration e = origInfo.getCRLs().getObjects(); e.hasMoreElements();)

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

for (Enumeration e = origInfo.getCertificates().getObjects(); e.hasMoreElements();)
  for (Enumeration e = origInfo.getCRLs().getObjects(); e.hasMoreElements();)

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

boolean asn1Equals(
  ASN1Primitive o)
{
  if (!(o instanceof ASN1Set))
  {
    return false;
  }
  ASN1Set   other = (ASN1Set)o;
  if (this.size() != other.size())
  {
    return false;
  }
  Enumeration s1 = this.getObjects();
  Enumeration s2 = other.getObjects();
  while (s1.hasMoreElements())
  {
    ASN1Encodable obj1 = getNext(s1);
    ASN1Encodable obj2 = getNext(s2);
    ASN1Primitive o1 = obj1.toASN1Primitive();
    ASN1Primitive o2 = obj2.toASN1Primitive();
    if (o1 == o2 || o1.equals(o2))
    {
      continue;
    }
    return false;
  }
  return true;
}

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

boolean asn1Equals(
  ASN1Primitive o)
{
  if (!(o instanceof ASN1Set))
  {
    return false;
  }
  ASN1Set   other = (ASN1Set)o;
  if (this.size() != other.size())
  {
    return false;
  }
  Enumeration s1 = this.getObjects();
  Enumeration s2 = other.getObjects();
  while (s1.hasMoreElements())
  {
    ASN1Encodable obj1 = getNext(s1);
    ASN1Encodable obj2 = getNext(s2);
    ASN1Primitive o1 = obj1.toASN1Primitive();
    ASN1Primitive o2 = obj2.toASN1Primitive();
    if (o1 == o2 || o1.equals(o2))
    {
      continue;
    }
    return false;
  }
  return true;
}

代码示例来源:origin: arhs/sd-dss

final ASN1Set signedDataCRLs = signedData.getCRLs();
if (signedDataCRLs != null) {
  final Enumeration<ASN1Encodable> crLs = signedDataCRLs.getObjects();
  if (crLs != null) {
    while (crLs.hasMoreElements()) {

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

e = ((ASN1Set)obj).getObjects();

代码示例来源:origin: arhs/sd-dss

/**
 * The field crlsHashIndex is a sequence of octet strings. Each one contains the hash value of one instance of
 * RevocationInfoChoice within crls field of the root SignedData. A hash value for every instance of
 * RevocationInfoChoice, as present at the time when the corresponding archive time-stamp is requested, shall be
 * included in crlsHashIndex. No other hash values shall be included in this field.
 *
 * @return
 * @throws eu.europa.ec.markt.dss.exception.DSSException
 */
@SuppressWarnings("unchecked")
private ASN1Sequence getCRLsHashIndex() throws DSSException {
  final ASN1EncodableVector crlsHashIndex = new ASN1EncodableVector();
  final SignedData signedData = SignedData.getInstance(cadesSignature.getCmsSignedData().toASN1Structure().getContent());
  final ASN1Set signedDataCRLs = signedData.getCRLs();
  if (signedDataCRLs != null) {
    final Enumeration<ASN1Encodable> crLs = signedDataCRLs.getObjects();
    if (crLs != null) {
      while (crLs.hasMoreElements()) {
        final ASN1Encodable asn1Encodable = crLs.nextElement();
        digestAndAddToList(crlsHashIndex, DSSASN1Utils.getDEREncoded(asn1Encodable));
      }
    }
  }
  return new DERSequence(crlsHashIndex);
}

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

e = ((ASN1Set)obj).getObjects();

相关文章