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

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

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

ASN1Sequence.toArray介绍

暂无

代码示例

代码示例来源:origin: igniterealtime/Openfire

private String doPrimitive(ASN1Primitive primitive) throws IOException {
  if (primitive == null || primitive instanceof ASN1Null) {
    return "";
  } else if (primitive instanceof ASN1Sequence) {
    return doCollection(((ASN1Sequence) primitive).toArray());
  } else if (primitive instanceof ASN1Set) {
    return doCollection(((ASN1Set) primitive).toArray());
  } else if (primitive instanceof DERTaggedObject) {
    final DERTaggedObject tagged = ((DERTaggedObject) primitive);
    return "<table><tr><td>" + /* tagged.getTagNo() + */ "</td><td>" + doPrimitive(tagged.getObject()) + "</td></tr></table>";
  } else {
    return "<table><tr><td colspan='2'>" + asString(primitive) + "</td></tr></table>";
  }
}

代码示例来源:origin: hyperledger/fabric-sdk-java

if (asn1 instanceof ASN1Sequence) {
  ASN1Sequence asn1Sequence = (ASN1Sequence) asn1;
  ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
  for (ASN1Encodable asn1Encodable : asn1Encodables) {
    ASN1Primitive asn1Primitive = asn1Encodable.toASN1Primitive();

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

public Iterator<ASN1Encodable> iterator()
  {
    return new Arrays.Iterator<ASN1Encodable>(toArray());
  }
}

代码示例来源:origin: de.adorsys.psd2/psd2-validator

public static RolesOfPSP getInstance(Object obj) {
  if (obj instanceof RolesOfPSP) {
    return (RolesOfPSP) obj;
  }
  ASN1Encodable[] array = DERSequence.getInstance(obj).toArray();
  RoleOfPSP[] roles = Arrays.stream(array).map(RoleOfPSP::getInstance).toArray(RoleOfPSP[]::new);
  return new RolesOfPSP(roles);
}

代码示例来源:origin: adorsys/xs2a

public static RolesOfPSP getInstance(Object obj) {
  if (obj instanceof RolesOfPSP) {
    return (RolesOfPSP) obj;
  }
  ASN1Encodable[] array = DERSequence.getInstance(obj).toArray();
  RoleOfPSP[] roles = Arrays.stream(array).map(RoleOfPSP::getInstance).toArray(RoleOfPSP[]::new);
  return new RolesOfPSP(roles);
}

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

/**
 * Creates list of <code>PolicyMapping</code> objects from an <code>PolicyMappings</code> object.
 *
 * @param policyMappings
 * @return List of PolicyMapping
 */
public static List<PolicyMapping> getListOfPolicyMappings(PolicyMappings policyMappings) {
  ASN1Sequence policyMappingsSeq = (ASN1Sequence) policyMappings.toASN1Primitive();
  ASN1Encodable[] policyMappingsArray = policyMappingsSeq.toArray();
  List<PolicyMapping> policyMappingsList = new ArrayList<>();
  for (ASN1Encodable asn1Encodable : policyMappingsArray) {
    policyMappingsList.add(PolicyMapping.getInstance(asn1Encodable));
  }
  return policyMappingsList;
}

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

for (ASN1Encodable asn1Encodable : asn1Sequence.toArray()) {
  SMIMECapability capability = SMIMECapability.getInstance(asn1Encodable);
  ASN1ObjectIdentifier oid = capability.getCapabilityID();

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

for (ASN1Encodable policyMapping : policyMappingsSeq.toArray()) {

代码示例来源:origin: stackoverflow.com

ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
for (ASN1Encodable asn1Encodable : asn1Encodables) {
  ASN1Primitive asn1Primitive = asn1Encodable.toASN1Primitive();

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

for (ASN1Encodable asn1Encodable : asn1Sequence.toArray()) {
  BiometricData biometricData = BiometricData.getInstance(asn1Encodable);
  TypeOfBiometricData typeOfBiometricData = biometricData.getTypeOfBiometricData();

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

/**
 * Load the PolicyMappingsTableModel with policy mappings.
 *
 * @param policyMappings
 *            The policy mappings
 */
public void load(PolicyMappings policyMappings) {
  ASN1Sequence policyMappingsSeq = (ASN1Sequence) policyMappings.toASN1Primitive();
  // convert and sort
  ASN1Encodable[] asn1EncArray = policyMappingsSeq.toArray();
  PolicyMapping[] policyMappingsArray = new PolicyMapping[asn1EncArray.length];
  for (int i = 0; i < asn1EncArray.length; i++) {
    policyMappingsArray[i] = PolicyMapping.getInstance(asn1EncArray[i]);
  }
  Arrays.sort(policyMappingsArray, new IssuerDomainPolicyComparator());
  data = new Object[policyMappingsArray.length][2];
  int i = 0;
  for (PolicyMapping policyMapping : policyMappingsArray) {
    data[i][0] = policyMapping;
    data[i][1] = policyMapping;
    i++;
  }
  fireTableDataChanged();
}

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

final ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
final StringBuilder stringBuilder = new StringBuilder();

代码示例来源:origin: org.hyperledger.fabric-sdk-java/fabric-sdk-java

if (asn1 instanceof ASN1Sequence) {
  ASN1Sequence asn1Sequence = (ASN1Sequence) asn1;
  ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
  for (ASN1Encodable asn1Encodable : asn1Encodables) {
    ASN1Primitive asn1Primitive = asn1Encodable.toASN1Primitive();

代码示例来源:origin: GluuFederation/oxAuth

ASN1Encodable[] softwareEnforced = ((ASN1Sequence) extensionData.getObjectAt(AndroidKeyUtils.SW_ENFORCED_INDEX)).toArray();
ASN1Encodable[] teeEnforced = ((ASN1Sequence) extensionData.getObjectAt(AndroidKeyUtils.TEE_ENFORCED_INDEX)).toArray();

代码示例来源:origin: esig/dss

final ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
final StringBuilder stringBuilder = new StringBuilder();

代码示例来源:origin: org.igniterealtime.openfire/xmppserver

private String doPrimitive(ASN1Primitive primitive) throws IOException {
  if (primitive == null || primitive instanceof ASN1Null) {
    return "";
  } else if (primitive instanceof ASN1Sequence) {
    return doCollection(((ASN1Sequence) primitive).toArray());
  } else if (primitive instanceof ASN1Set) {
    return doCollection(((ASN1Set) primitive).toArray());
  } else if (primitive instanceof DERTaggedObject) {
    final DERTaggedObject tagged = ((DERTaggedObject) primitive);
    return "<table><tr><td>" + /* tagged.getTagNo() + */ "</td><td>" + doPrimitive(tagged.getObject()) + "</td></tr></table>";
  } else {
    return "<table><tr><td colspan='2'>" + asString(primitive) + "</td></tr></table>";
  }
}

代码示例来源:origin: esig/dss

public static Map<String, String> get(final X500Principal x500Principal) {
  Map<String, String> treeMap = new HashMap<String, String>();
  final byte[] encoded = x500Principal.getEncoded();
  final ASN1Sequence asn1Sequence = ASN1Sequence.getInstance(encoded);
  final ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
  for (final ASN1Encodable asn1Encodable : asn1Encodables) {
    final DLSet dlSet = (DLSet) asn1Encodable;
    for (int ii = 0; ii < dlSet.size(); ii++) {
      final DLSequence dlSequence = (DLSequence) dlSet.getObjectAt(ii);
      if (dlSequence.size() != 2) {
        throw new DSSException("The DLSequence must contains exactly 2 elements.");
      }
      final ASN1Encodable asn1EncodableAttributeType = dlSequence.getObjectAt(0);
      final String stringAttributeType = getString(asn1EncodableAttributeType);
      final ASN1Encodable asn1EncodableAttributeValue = dlSequence.getObjectAt(1);
      final String stringAttributeValue = getString(asn1EncodableAttributeValue);
      treeMap.put(stringAttributeType, stringAttributeValue);
    }
  }
  return treeMap;
}

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

return new BERSet(s.toArray());
return new DLSet(s.toArray());

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

private static HashMap<String, String> get(final X500Principal x500Principal) {
  HashMap<String, String> treeMap = new HashMap<String, String>();
  final byte[] encoded = x500Principal.getEncoded();
  final ASN1Sequence asn1Sequence = ASN1Sequence.getInstance(encoded);
  final ASN1Encodable[] asn1Encodables = asn1Sequence.toArray();
  for (final ASN1Encodable asn1Encodable : asn1Encodables) {
    final DLSet dlSet = (DLSet) asn1Encodable;
    for (int ii = 0; ii < dlSet.size(); ii++) {
      final DLSequence dlSequence = (DLSequence) dlSet.getObjectAt(ii);
      if (dlSequence.size() != 2) {
        throw new DSSException("The DLSequence must contains exactly 2 elements.");
      }
      final ASN1Encodable asn1EncodableAttributeType = dlSequence.getObjectAt(0);
      final String stringAttributeType = getString(asn1EncodableAttributeType);
      final ASN1Encodable asn1EncodableAttributeValue = dlSequence.getObjectAt(1);
      final String stringAttributeValue = getString(asn1EncodableAttributeValue);
      treeMap.put(stringAttributeType, stringAttributeValue);
    }
  }
  return treeMap;
}

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

相关文章