document.write('<link rel="stylesheet" type="text/css" href="http://www.naslu.com/css/SyntaxHighlighter.css" />');
document.write('<p style="font-family: Arial;font-size:16px;color: #444444;font-weight: bold;">');
document.write('<a href="http://www.naslu.com/resource.aspx?id=149">Crypt and Decrypt with Java</a>');
document.write('</p>');
document.write('<textarea name="code" id="code" class="java" rows="1" cols="1">');
document.write('public static String decrypt3DES(String code, SecretKey key)\n	throws NoSuchAlgorithmException, InvalidKeyException, IOException,\n    IllegalBlockSizeException, NoSuchPaddingException,\n    BadPaddingException {\n		\n		Cipher cipher = Cipher.getInstance("DESede");\n		cipher.init(Cipher.DECRYPT_MODE, key);		\n		\n		BASE64Decoder decoder = new BASE64Decoder(); \n		byte[] raw = decoder.decodeBuffer(code); \n		byte[] stringBytes = cipher.doFinal(raw); \n		String result = new String(stringBytes,"UTF8"); \n  \n		return result;		\n	}\n	\n	public static String encrypt3DES(String code, SecretKey key)\n	throws NoSuchAlgorithmException, InvalidKeyException,\n    NoSuchPaddingException, IOException, IllegalStateException, IllegalBlockSizeException, BadPaddingException {\n  \n		Cipher cipher = Cipher.getInstance("DESede");	    \n		cipher.init(Cipher.ENCRYPT_MODE,key); \n  \n		byte[] stringBytes=code.getBytes("UTF8"); \n		byte[] raw=cipher.doFinal(stringBytes); \n		BASE64Encoder encoder = new BASE64Encoder(); \n		String base64 = encoder.encode(raw); \n			\n		return base64;	\n	}');
document.write('</textarea>');
document.write('<script languaje="javascript" type="text/javascript">');
document.write('dp.SyntaxHighlighter.ClipboardSwf = \'http://www.naslu.com/flash/clipboard.swf\';dp.SyntaxHighlighter.HighlightAll("code");');
document.write('</script>');
document.write('<a href="http://www.naslu.com" style="font-family:Arial;font-size:9px;color:#444444;font-weight:bold;">Powered by naslu.com</a>');