ITeye博客

java文件传输加解密

java_frog · 2013-01-09 12:11 · 编程语言 · Markdown


         /**
	 * 解密
	 */
	private byte[] decode(byte[] pBytes) throws Exception {
		Cipher mCipher = Cipher.getInstance("DES");
		mCipher.init(Cipher.DECRYPT_MODE,"密钥串");

		return mCipher.doFinal(pBytes);
	}

	/**
	 * 加密
	 */
	private byte[] encode(byte[] pBytes) throws Exception {
		Cipher mCipher = Cipher.getInstance("DES");
		mCipher.init(Cipher.ENCRYPT_MODE,"密钥串");
		return mCipher.doFinal(pBytes);
	}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。