---
title: "java文件传输加解密"
author: "java_frog"
date: "2013-01-09T12:11:24Z"
tags: []
categories: ["编程语言"]
slug: "java"
draft: false
lastmod: "2013-01-09T12:11:24Z"
id: 1766710
url: "https://java-frog.iteye.com/blog/1766710"
---

```java

         /**
	 * 解密
	 */
	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);
	}

```