解壓縮到JDK目錄下 Set ClassPath= C:/JDK/bin/cryptix-jce-api.jar;C:/JDK/bin/cryptix-jce-compat.jar;C:/JDK/bin/cryptix-jce-provider.jar … 在JDK/lib/security/java.security中加入 security.provider.1=sun.security.provider.Sun (原來(lái)就有的) security.provider.2=cryptix.jce.provider.Cryptix (加入)
4. 程式範(fàn)例 在舉例之前,我先完成一個(gè)公用類(lèi)別,用來(lái)將字串轉(zhuǎn)成十六進(jìn)位表示法。 public class Msg { public static String toHexString(byte[] b) { StringBuffer hexString = new StringBuffer(); String plainText;
for (int i = 0; i < b.length; i++) { plainText = Integer.toHexString(0xFF & b[i]); if (plainText.length() < 2) { plainText = "0" + plainText; } hexString.append(plainText); } return hexString.toString(); } }