org.xipki.util.Hex.decode()方法的使用及代码示例

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

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

Hex.decode介绍

暂无

代码示例

代码示例来源:origin: org.xipki/security

/**
 * Returns the hex representation of the bytes.
 *
 * @param bytes
 *          Data to be encoded. Must not be {@code null}.
 * @return the hex representation of the bytes.
 */
protected static byte[] decodeHex(String hex) {
 return Hex.decode(hex);
}

代码示例来源:origin: org.xipki/security-pkcs11

/**
 * Returns the hex representation of the bytes.
 *
 * @param bytes
 *          Data to be encoded. Must not be {@code null}.
 * @return the hex representation of the bytes.
 */
protected static byte[] decodeHex(String hex) {
 return Hex.decode(hex);
}

代码示例来源:origin: xipki/xipki

public static byte[] decode(String hex) {
 return decode(hex.toCharArray());
}

代码示例来源:origin: org.xipki/security

private static void addDigestPkcsPrefix(HashAlgo algo, String prefix) {
 digestPkcsPrefix.put(algo, Hex.decode(prefix));
}

代码示例来源:origin: org.xipki/util

public static byte[] decode(String hex) {
 return decode(hex.toCharArray());
}

代码示例来源:origin: org.xipki/ca-server

private static byte[] getTransactionIdBytes(String tid) throws OperationException {
 byte[] bytes = null;
 final int n = tid.length();
 if (n % 2 != 0) { // neither hex nor base64 encoded
  bytes = tid.getBytes();
 } else {
  try {
   bytes = Hex.decode(tid);
  } catch (Exception ex) {
   if (n % 4 == 0) {
    try {
     bytes = Base64.decode(tid);
    } catch (Exception ex2) {
     LOG.error("could not decode (hex or base64) '{}': {}", tid, ex2.getMessage());
    }
   }
  }
 }
 if (bytes == null) {
  bytes = tid.getBytes();
 }
 if (bytes.length > 20) {
  throw new OperationException(ErrorCode.BAD_REQUEST, "transactionID too long");
 }
 return bytes;
} // method getTransactionIdBytes

代码示例来源:origin: org.xipki/security

byte[] keyId = null;
if (str != null) {
 keyId = Hex.decode(str);

代码示例来源:origin: org.xipki/security-pkcs11

byte[] keyId = null;
if (str != null) {
 keyId = Hex.decode(str);

相关文章

微信公众号

最新文章

更多