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

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

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

Hex.decode介绍

暂无

代码示例

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

public static final byte[] format(BigInteger i, int length) {
    String s = i.toString();
    if ((s.length() % 2) != 0) {
      s = "0" + s;
    }
    return Bytes.leftPad(Hex.decode(s), length);
  }
}

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

private void checkDataTrailer() throws IssuerPublicKeyException {
  if (!Arrays.equals(issuerData.get(DATA_TRAILER), Hex.decode("BC"))) {
    throw new IssuerPublicKeyException("The Recovered Data Trailer is not equal to 0xBC");
  }
}

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

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

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

private void checkCertificateFormat() throws ICCPublicKeyException {
  byte[] certificateFormat = recoveredData.get(CERTIFICATE_FORMAT);
  if (!Arrays.equals(certificateFormat, Hex.decode("04"))) {
    throw new ICCPublicKeyException("Illegal Certificate Format: " + Hex.encode(certificateFormat));
  }
}

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

@Test(expected = IllegalArgumentException.class)
  public final void testDecodeWithIllegalCharacter() {
    Hex.decode("12G3");
  }
}

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

@Test
public final void testDecodeMoreBytes() {
  for (int i = Byte.MIN_VALUE, j = Byte.MAX_VALUE; i <= Byte.MAX_VALUE; i++, j--) {
    final byte[] expecteds = new byte[] { (byte) i, (byte) j };
    String hexString = String.format("%02x", i & 0xFF);
    hexString += String.format("%02x", j & 0xFF);
    Assert.assertArrayEquals(expecteds,
        Hex.decode(hexString.toLowerCase()));
    Assert.assertArrayEquals(expecteds,
        Hex.decode(hexString.toUpperCase()));
  }
}

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

@Test
public final void simpleRightPad() {
  byte[] expecteds = Hex.decode("123400");
  byte[] actuals = Bytes.rightPad(Hex.decode("1234"), 3);
  Assert.assertArrayEquals(expecteds, actuals);
}

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

@Test
public final void left() {
  byte[] input = Hex.decode("123456");
  byte[] expecteds = Hex.decode("1234");
  byte[] actuals = Bytes.left(input, 2);
  Assert.assertArrayEquals(expecteds, actuals);
}

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

@Test
public final void testDecodeEmptyString() {
  final byte[] expecteds = new byte[0];
  final byte[] actuals = Hex.decode("");
  Assert.assertArrayEquals(expecteds, actuals);
}

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

@Test
public final void leftPadEmptyBytesWith0xFF() {
  byte[] expecteds = Hex.decode("FFFFFFFFFF");
  byte[] actuals = Bytes.leftPad(Bytes.EMPTY, 5, 0xFF);
  Assert.assertArrayEquals(expecteds, actuals);
}

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

@Test
public final void binaryStringWithSeparator() {
  byte[] bytes = Hex.decode("1234");
  String expected = "00010010 00110100";
  String actual = Bytes.toBinaryString(bytes, ' ');
  Assert.assertEquals(expected, actual);
}

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

@Test
public void assertTC() {
  CryptogramType actual = CryptogramInformationData.parse(Hex.decode("40")).getCryptogramType();
  Assert.assertEquals(CryptogramType.TC, actual);
}

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

@Test(expected = BufferOverflowException.class)
public final void bufferOverflow() {
  byte[] src = getBytes(4);
  Buffer buffer = factory.createBuffer(src.length);
  buffer.put(Hex.decode("1234567890"));
}

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

@Test
  public final void test() {
    byte[] bytes = Hex.decode("020000000200dd07090006000700100025003500da00000000000104000000000000");
    Buffer buffer = BufferFactory.getInstance().createBuffer(bytes.length);
    buffer.put(bytes);
    WFSResult wfsResult = new WFSResult(buffer.getPointer());
    System.out.println(wfsResult);
  }
}

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

@Test
public void testCase4CommandAccepted() throws IOException {
  TestReader reader = new TestReader(T0_ATR);
  CAPDU capdu = SelectCommand.selectFirstByName(Hex.decode("123456"));
  RAPDU rapdu = reader.expect("00A4040003123456", "9000").expect("00C0000000", "CAFEBABE9000").transmit(capdu);
  Assert.assertArrayEquals(Hex.decode("CAFEBABE"), rapdu.getData());
  Assert.assertEquals(SW_SUCCESS, rapdu.getSW());
}

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

@Test
public final void test() {
  ItemInfo330 expected = new ItemInfo330(buildItemInfo330().getPointer());
  ItemInfo330 actual = new ItemInfo330(expected);
  System.out.println(actual);
  assertEquals(expected, actual);
  assertArrayEquals(Hex.decode("ABCDEF"), actual.getSignature().get().getData());
}

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

@Test
public void test() {
  WfsPinCrypt pinCrypt = new WfsPinCrypt();
  pinCrypt.allocate();
  pinCrypt.setMode(PinMode.ENCRYPT);
  pinCrypt.setKey("MAK");
  pinCrypt.setAlgorithm(PINAlgorithm.TRIDESMAC);
  pinCrypt.setStartValue(new byte[8]);
  pinCrypt.setCryptData(Hex.decode("CAFFEE"));
  System.out.println(pinCrypt);
}

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

@Test
public final void testAllBitsSet() {
  final byte b = Hex.decode("ff")[0];
  Assert.assertTrue(Bit.isSet(b, Bit.B1));
  Assert.assertTrue(Bit.isSet(b, Bit.B2));
  Assert.assertTrue(Bit.isSet(b, Bit.B3));
  Assert.assertTrue(Bit.isSet(b, Bit.B4));
  Assert.assertTrue(Bit.isSet(b, Bit.B5));
  Assert.assertTrue(Bit.isSet(b, Bit.B6));
  Assert.assertTrue(Bit.isSet(b, Bit.B7));
  Assert.assertTrue(Bit.isSet(b, Bit.B8));
}

相关文章

微信公众号

最新文章

更多