at.o2xfs.common.Hex.encode()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(97)

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

Hex.encode介绍

暂无

代码示例

代码示例来源:origin: AndreasFagschlunger/O2Xfs

@Override
  public String toString() {
    return Hex.encode(value);
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

@Override
public String toString() {
  return "TS=" + Hex.encode(ts)
      + ",T0="
      + t0
      + ",interfaceCharacters="
      + toString(interfaceCharacters)
      + ",historicalBytes="
      + Hex.encode(historicalBytes)
      + ",TCK="
      + (tck == null ? "" : Hex.encode(tck.byteValue()));
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

public CVRule(byte[] rule) {
  if (rule.length != 2) {
    throw new IllegalArgumentException("Illegal CVRule: "
        + Hex.encode(rule));
  }
  this.rule = Bytes.copy(rule);
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

public static final HashAlgorithm getByAlgorithmIndicator(
      byte[] algorithmIndicator) throws NoSuchAlgorithmException {
    for (HashAlgorithm algorithm : values()) {
      if (Arrays.equals(algorithmIndicator, algorithm.algorithmIndicator)) {
        return algorithm;
      }
    }
    throw new NoSuchAlgorithmException(
        "Unrecognized Hash Algorithm Indicator: "
            + Hex.encode(algorithmIndicator));
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void checkRecoveredDataTrailer() throws OfflineDynamicDataAuthenticationFailedException {
  byte[] dataTrailer = recoveredData.get(DATA_TRAILER);
  if (!Arrays.equals(dataTrailer, Hex.decode("BC"))) {
    throw new OfflineDynamicDataAuthenticationFailedException("Illegal Data Trailer: " + Hex.encode(dataTrailer));
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void checkRecoveredDataHeader() throws OfflineDynamicDataAuthenticationFailedException {
  byte[] dataHeader = recoveredData.get(DATA_HEADER);
  if (!Arrays.equals(dataHeader, Hex.decode("6A"))) {
    throw new OfflineDynamicDataAuthenticationFailedException("Illegal Data Header: " + Hex.encode(dataHeader));
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

Application getApplication() {
  byte[] aid = getMandatoryData(EMVTag.APPLICATION_IDENTIFIER_TERMINAL);
  for (Application application : terminal.getApplications()) {
    if (application.matches(aid)) {
      return application;
    }
  }
  throw new RuntimeException("Unsupported Application: " + Hex.encode(aid));
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

public static final TerminalCapabilities create(byte[] bytes)
      throws TerminalException {
    if (bytes == null) {
      throw new NullPointerException("bytes must not be null");
    } else if (bytes.length != 3) {
      throw new TerminalException("Illegal TerminalCapabilities: "
          + Hex.encode(bytes));
    }
    return new TerminalCapabilities(Bytes.copy(bytes));
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void checkDataTrailer() throws ICCPublicKeyException {
  byte[] dataTrailer = recoveredData.get(DATA_TRAILER);
  if (!Arrays.equals(dataTrailer, Hex.decode("BC"))) {
    throw new ICCPublicKeyException("Illegal Data Trailer: " + Hex.encode(dataTrailer));
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void checkSignedDataFormat() throws OfflineDynamicDataAuthenticationFailedException {
  byte[] signedDataFormat = recoveredData.get(SIGNED_DATA_FORMAT);
  if (!Arrays.equals(signedDataFormat, Hex.decode("05"))) {
    throw new OfflineDynamicDataAuthenticationFailedException("Illegal Signed Data Format: " + Hex.encode(signedDataFormat));
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void checkICCPublicKeyAlgorithmIndicator() throws ICCPublicKeyException {
  byte[] algorithmIndicator = recoveredData.get(ICC_PUBLIC_KEY_ALGORITHM_INDICATOR);
  for (AsymmetricAlgorithm algorithm : AsymmetricAlgorithm.values()) {
    if (Arrays.equals(algorithmIndicator, algorithm.getAlgorithmIndicator())) {
      return;
    }
  }
  throw new ICCPublicKeyException("Unrecognised ICC Public Key Algorithm: " + Hex.encode(algorithmIndicator));
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void validateTA3() throws ATRValidatorException {
  if (!atr.containsTA(3)) {
    return;
  }
  final int ta3 = atr.getTA(3) & 0xFF;
  if (ta3 <= 0x0F || ta3 == 0xFF) {
    throw new ATRValidatorException("Invalid value for TA3: "
        + Hex.encode((byte) ta3));
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void validateTC3() throws ATRValidatorException {
    if (!atr.containsTC(3)) {
      return;
    }
    final byte tc3 = atr.getTC(3);
    if (tc3 != 0) {
      throw new ATRValidatorException("Invalid value for TC3: "
          + Hex.encode(tc3));
    }
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

@Test
public final void testEncode() {
  for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
    final String expected = String.format("%02X",
        Integer.valueOf(i & 0xFF));
    final String actual = Hex.encode(new byte[] { (byte) i });
    Assert.assertEquals(expected, actual);
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void parse(byte[] tlv, int offset) {
  try {
    tag = Tag.parse(tlv, offset);
    offset += tag.size();
    parseLength(tlv, offset);
    offset += lengthSize;
    parseValue(tlv, offset);
  } catch (TagParseException e) {
    throw new TLVParseException("Error parsing TLV: " + Hex.encode(tlv)
        + ", Offset: " + offset, e);
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private void checkCertificateExpirationDate() throws ICCPublicKeyException {
  byte[] expirationDate = recoveredData.get(CERTIFICATE_EXPIRATION_DATE);
  try {
    if (new ExpirationDate(expirationDate).hasExpired()) {
      throw new ICCPublicKeyException("Certificate has expired: " + Hex.encode(expirationDate));
    }
  } catch (ExpirationDateException e) {
    throw new ICCPublicKeyException(e);
  }
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

public byte[] process(TLV issuerScript) throws IOException {
  final String method = "processScript(TLV)";
  beforeFinalGenerateAC = EMVTag.ISSUER_SCRIPT_TEMPLATE_1.getTag().equals(issuerScript.getTag());
  List<TLV> commands = issuerScript.getChildren();
  scriptID = extractScriptID(issuerScript.getChildren());
  if (LOG.isInfoEnabled()) {
    LOG.info(method, "Script ID: " + Hex.encode(scriptID));
  }
  return processIssuerScripts(commands);
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

private Template parseResponseMessageTemplate(byte[] data) throws TerminateSessionException {
  TLV tlv = TLV.parse(data);
  if (EMVTag.RESPONSE_MESSAGE_TEMPLATE_FORMAT_1.getTag().equals(tlv.getTag())) {
    return parseFormat1(tlv.getValue());
  } else if (EMVTag.RESPONSE_MESSAGE_TEMPLATE_FORMAT_2.getTag().equals(tlv.getTag())) {
    return parseFormat2(tlv);
  }
  throw new TerminateSessionException("Illegal GENERATE AC Response Message: " + Hex.encode(data));
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

@Test
public final void test() {
  HexData310 expected = new HexData310(buildHexData310().getPointer());
  HexData310 actual = new HexData310(expected);
  System.out.println(actual);
  assertEquals(expected, actual);
  assertEquals("CAFEBABE", Hex.encode(actual.getData()));
}

代码示例来源:origin: AndreasFagschlunger/O2Xfs

@Test
public void testCase2LeAccepted() throws IOException {
  TestReader reader = new TestReader(T0_ATR);
  CAPDU capdu = new CAPDU(0x80, 0xCA, 0x9F, 0x17, 0x01);
  RAPDU rapdu = reader.expect("80CA9F1701", "039000").transmit(capdu);
  Assert.assertEquals("03", Hex.encode(rapdu.getData()));
  Assert.assertEquals(SW_SUCCESS, rapdu.getSW());
}

相关文章

微信公众号

最新文章

更多