public static void main (String [] args) throws Exception { byte [] key = Base64.decode ("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4". getBytes (), Base64.DEFAULT); byte [] keyiv = {1, 2, 3, 4, 5, 6, 7, 8}; byte [] data = "China ABCabc123". getBytes ("UTF-8"); System.out.println ("ECB encryption and decryption"); byte [] str3 = des3EncodeECB (key, data); byte [] str4 = ees3DecodeECB (key, str3); System.out.println (new String (Base64.encode (str3, Base64.DEFAULT), "UTF-8")); System.out.println (new String (str4, "UTF-8")); System.out.println (); System.out.println ("CBC encryption and decryption"); byte [] str5 = des3EncodeCBC (key, keyiv, data); byte [] str6 = des3DecodeCBC (key, keyiv, str5); System.out.println (new String (Base64.encode (str5, Base64.DEFAULT), "UTF-8")); System.out.println (new String (str6, "UTF-8")); }