本文整理了Java中at.o2xfs.common.Hex
类的一些代码示例,展示了Hex
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hex
类的具体详情如下:
包路径:at.o2xfs.common.Hex
类名称:Hex
暂无
代码示例来源:origin: AndreasFagschlunger/O2Xfs
@Override
public String toString() {
return Hex.encode(value);
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private byte[] newTransactionDate() {
String hex = new SimpleDateFormat(DATE_PATTERN).format(new Date());
return Hex.decode(hex);
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
public static final byte[] decode(final String hex) {
if (hex.length() > 0 && hex.length() % 2 != 0) {
throw new IllegalArgumentException("Odd number of characters: " + hex);
}
final byte[] bytes = new byte[hex.length() / 2];
for (int i = 0, j = 0; i < bytes.length; i++) {
int digit = toDigit(hex.charAt(j++));
bytes[i] = (byte) (digit << 4);
digit = toDigit(hex.charAt(j++));
bytes[i] |= digit;
}
return bytes;
}
代码示例来源: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
@Override
public String toString() {
return Hex.encode(rule);
}
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private byte[] newTransactionTime() {
String hex = new SimpleDateFormat(TIME_PATTERN).format(new Date());
return Hex.decode(hex);
}
代码示例来源: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
public TSI(byte[] tsi) {
if (tsi.length != TSI_LENGTH) {
throw new IllegalArgumentException("Illegal TSI: "
+ Hex.encode(tsi));
}
this.tsi = tsi;
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private TransactionLogEntry parseLogEntry(String line)
throws ParseException {
String[] parts = line.split(SEPERATOR);
Date transactionDate = new SimpleDateFormat(DATE_FORMAT)
.parse(parts[0]);
byte[] pan = Hex.decode(parts[1]);
byte[] panSequenceNumber = Bytes.EMPTY;
if (!parts[2].trim().isEmpty()) {
panSequenceNumber = Hex.decode(parts[2]);
}
BigInteger transactionAmount = new BigInteger(parts[3]);
return new TransactionLogEntry(pan, panSequenceNumber, transactionDate,
transactionAmount);
}
代码示例来源: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
public TransactionType(byte[] transactionType) {
if (transactionType.length != TRANSACTION_TYPE_LENGTH) {
throw new IllegalArgumentException("Illegal Transaction Type: "
+ Hex.encode(transactionType));
}
this.transactionType = transactionType;
}
代码示例来源: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 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
public static final int toInt(byte[] val) {
final int i = Integer.valueOf(Hex.encode(val), 16);
if (i < 0) {
throw new IllegalArgumentException("Negative int: "
+ Hex.encode(val));
}
return i;
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
private byte[] getBytes(Key key) {
String hex = getString(key);
if (hex != null) {
return Hex.decode(hex);
}
return null;
}
代码示例来源: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
@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
private CAPublicKey parseKey(CAPublicKeyBuilder builder, String value) {
String[] parts = value.split("_");
builder.modulus(Hex.decode(parts[0]));
builder.exponent(Hex.decode(parts[1]));
builder.checkSum(Hex.decode(parts[2]));
return builder.build();
}
代码示例来源:origin: AndreasFagschlunger/O2Xfs
@Override
protected RAPDU internalTransmit(byte[] ctpdu) throws IOException {
TPDU tpdu = tpdus.get(tpduIndex++);
Assert.assertEquals(tpdu.ctpdu, Hex.encode(ctpdu));
return new RAPDU(Hex.decode(tpdu.rtpdu));
}
内容来源于网络,如有侵权,请联系作者删除!