---
title: "byte数组加密解密"
author: "java_frog"
date: "2012-11-22T10:31:56Z"
tags: []
categories: ["编程语言"]
slug: "byte"
draft: false
lastmod: "2012-11-22T10:31:56Z"
id: 1732902
url: "https://java-frog.iteye.com/blog/1732902"
---

```java

	/**
	 * 解密
	 */
	private byte[] decode(byte[] pBytes) throws Exception {
		Cipher mCipher = Cipher.getInstance("DES");
		mCipher.init(Cipher.DECRYPT_MODE, 获取key);

		return mCipher.doFinal(pBytes);
	}

	/**
	 * 加密
	 */
	private byte[] encode(byte[] pBytes) throws Exception {
		Cipher mCipher = Cipher.getInstance("DES");
		mCipher.init(Cipher.ENCRYPT_MODE, 获取key);

		return mCipher.doFinal(pBytes);
	}

```