eu.europa.esig.dss.utils.Utils.areStringsEqual()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(129)

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

Utils.areStringsEqual介绍

暂无

代码示例

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

private XmlTLAnalysis getTlAnalysis(String countryCode) {
  for (XmlTLAnalysis xmlTLAnalysis : tlAnalysis) {
    if (Utils.areStringsEqual(countryCode, xmlTLAnalysis.getCountryCode())) {
      return xmlTLAnalysis;
    }
  }
  return null;
}

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

private boolean isIn(String algoToFind, List<Algo> algos) {
  for (Algo algo : algos) {
    if (Utils.areStringsEqual(algo.getValue(), algoToFind)) {
      return true;
    }
  }
  return false;
}

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

protected boolean processValueCheck(String value, String expected) {
  if (Utils.isStringEmpty(value)) {
    return false;
  }
  if (ALL_VALUE.equals(expected)) {
    return true;
  } else {
    return Utils.areStringsEqual(expected, value);
  }
}

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

private XmlTLAnalysis getTlAnalysis(String countryCode) {
  for (XmlTLAnalysis xmlTLAnalysis : tlAnalysis) {
    if (Utils.areStringsEqual(countryCode, xmlTLAnalysis.getCountryCode())) {
      return xmlTLAnalysis;
    }
  }
  return null;
}

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

private XmlConstraintsConclusion getTimestampValidation(TimestampWrapper newestTimestamp) {
  for (XmlValidationProcessTimestamps tspValidation : validationProcessTimestamps) {
    if (Utils.areStringsEqual(tspValidation.getId(), newestTimestamp.getId())) {
      return tspValidation;
    }
  }
  return null;
}

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

private XmlChainItem getCertificate(String certificateId) {
  List<XmlChainItem> chain = simpleReport.getChain();
  for (XmlChainItem xmlChainItem : chain) {
    if (Utils.areStringsEqual(certificateId, xmlChainItem.getId())) {
      return xmlChainItem;
    }
  }
  return null;
}

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

private List<String> getCoveredFilesBySignatureFilename(String signatureFilename) {
  List<XmlManifestFile> manifestFiles = containerInfo.getManifestFiles();
  for (XmlManifestFile xmlManifestFile : manifestFiles) {
    if (Utils.areStringsEqual(signatureFilename, xmlManifestFile.getSignatureFilename())) {
      return xmlManifestFile.getEntries();
    }
  }
  return new ArrayList<String>();
}

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

private int getExpectedKeySize(String encryptionAlgo, List<Algo> algos) {
  int expectedSize = 0;
  for (Algo algo : algos) {
    if (Utils.areStringsEqual(algo.getValue(), encryptionAlgo)) {
      String size = algo.getSize();
      if (Utils.isStringDigits(size)) {
        expectedSize = Integer.parseInt(size);
      }
    }
  }
  return expectedSize;
}

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

private Date getExpirationDate(String algoToFind, List<Algo> algos, String format) {
  SimpleDateFormat dateFormat = new SimpleDateFormat(Utils.isStringEmpty(format) ? DATE_FORMAT : format);
  Date result = null;
  for (Algo algo : algos) {
    if (Utils.areStringsEqual(algoToFind, algo.getValue()) && Utils.isStringNotEmpty(algo.getDate())) {
      try {
        result = dateFormat.parse(algo.getDate());
      } catch (Exception e) {
        LOG.warn("Unable to parse date with pattern '{}' : {}", dateFormat.toPattern(), e.getMessage());
      }
    }
  }
  return result;
}

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

/**
 * This method returns the RevocationWrapper corresponding to the id
 *
 * @param id
 *            id of the revocation data
 * @return revocation wrapper or null
 */
public RevocationWrapper getRevocationDataById(String id) {
  Set<RevocationWrapper> revocationData = getAllRevocationData();
  for(RevocationWrapper rd : revocationData) {
    if(Utils.areStringsEqual(rd.getId(), id)) {
      return rd;
    }
  }
  return null;
}

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

@Override
protected boolean process() {
  String signingCertificateId = token.getSigningCertificateId();
  CertificateWrapper certificate = diagnosticData.getUsedCertificateByIdNullSafe(signingCertificateId);
  return Utils.areStringsEqual(signingCertificateId, certificate.getId());
}

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

public XmlSignature getXmlSignatureById(String signatureId) {
  List<XmlSignature> signatures = jaxbDetailedReport.getSignatures();
  if (Utils.isCollectionNotEmpty(signatures)) {
    for (XmlSignature xmlSignature : signatures) {
      if (Utils.areStringsEqual(signatureId, xmlSignature.getId())) {
        return xmlSignature;
      }
    }
  }
  return null;
}

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

private String getFormat(List<XmlDistinguishedName> distinguishedNames, String format) {
  if (Utils.isCollectionNotEmpty(distinguishedNames)) {
    for (XmlDistinguishedName distinguishedName : distinguishedNames) {
      if (Utils.areStringsEqual(distinguishedName.getFormat(), format)) {
        return distinguishedName.getValue();
      }
    }
  }
  return Utils.EMPTY_STRING;
}

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

@Test
public void areStringsEqual() {
  assertTrue(Utils.areStringsEqual(null, null));
  assertTrue(Utils.areStringsEqual("", ""));
  assertFalse(Utils.areStringsEqual("", "123"));
  assertFalse(Utils.areStringsEqual("123", "456"));
  assertFalse(Utils.areStringsEqual(null, ""));
  assertTrue(Utils.areStringsEqual("bla", "bla"));
  assertFalse(Utils.areStringsEqual("bla", "BLA"));
}

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

@Override
protected boolean process() {
  String policyId = signature.getPolicyId();
  if (multiValues.getId().contains(SignaturePolicy.NO_POLICY) && Utils.isStringEmpty(policyId)) {
    return true;
  } else if (multiValues.getId().contains(SignaturePolicy.ANY_POLICY) && Utils.isStringNotEmpty(policyId)) {
    return true;
  } else if (multiValues.getId().contains(SignaturePolicy.IMPLICIT_POLICY) && Utils.areStringsEqual(SignaturePolicy.IMPLICIT_POLICY, policyId)) {
    return true;
  }
  // oids
  return processValueCheck(policyId);
}

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

/**
 * This method returns a signature wrapper for the given signature id
 * 
 * @param id
 *            the signature id
 * @return a signature wrapper or null
 */
public SignatureWrapper getSignatureById(String id) {
  List<SignatureWrapper> signatures = getSignatures();
  if (Utils.isCollectionNotEmpty(signatures)) {
    for (SignatureWrapper xmlSignature : signatures) {
      if (Utils.areStringsEqual(id, xmlSignature.getId())) {
        return xmlSignature;
      }
    }
  }
  return null;
}

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

/**
 * This method returns a certificate wrapper for the given certificate id
 * 
 * @param id
 *            the certificate id
 * @return a certificate wrapper or null
 */
public CertificateWrapper getUsedCertificateById(String id) {
  List<CertificateWrapper> certificates = getUsedCertificates();
  if (Utils.isCollectionNotEmpty(certificates)) {
    for (CertificateWrapper certificate : certificates) {
      if (Utils.areStringsEqual(id, certificate.getId())) {
        return certificate;
      }
    }
  }
  return null;
}

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

public boolean isIdKpOCSPSigning() {
  List<XmlOID> extendedKeyUsages = certificate.getExtendedKeyUsages();
  if (Utils.isCollectionNotEmpty(extendedKeyUsages)) {
    for (XmlOID xmlOID : extendedKeyUsages) {
      if (Utils.areStringsEqual(ExtendedKeyUsageOids.OCSP_SIGNING.getOid(), xmlOID.getValue())) {
        return true;
      }
    }
  }
  return false;
}

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

private XmlValidationProcessTimestamps getTimestampValidationById(String timestampId) {
  List<XmlSignature> signatures = jaxbDetailedReport.getSignatures();
  if (Utils.isCollectionNotEmpty(signatures)) {
    for (XmlSignature xmlSignature : signatures) {
      List<XmlValidationProcessTimestamps> validationTimestamps = xmlSignature.getValidationProcessTimestamps();
      if (Utils.isCollectionNotEmpty(validationTimestamps)) {
        for (XmlValidationProcessTimestamps tspValidation : validationTimestamps) {
          if (Utils.areStringsEqual(tspValidation.getId(), timestampId)) {
            return tspValidation;
          }
        }
      }
    }
  }
  return null;
}

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

private SignatureWrapper getSignatureByIdNullSafe(String id) {
  List<SignatureWrapper> signatures = getSignatures();
  if (Utils.isCollectionNotEmpty(signatures)) {
    for (SignatureWrapper xmlSignature : signatures) {
      if (Utils.areStringsEqual(id, xmlSignature.getId())) {
        return xmlSignature;
      }
    }
  }
  return new SignatureWrapper(new XmlSignature()); // TODO improve ?
}

相关文章