cac6780684d4ecae39d3212fa5e3ff1b6beca150.svn-base 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package cn.com.goldenwater.dcproj.util;
  2. import org.apache.commons.codec.binary.Base64;
  3. public class Base64Util {
  4. /**
  5. * 解密
  6. *
  7. * @param value
  8. * @return
  9. * @see [类、类#方法、类#成员]
  10. */
  11. public static String decodeStr(String value) {
  12. byte[] debytes = Base64.decodeBase64(value.getBytes());
  13. return new String(debytes);
  14. }
  15. /**
  16. * 加密
  17. *
  18. * @param value
  19. * @return
  20. * @see [类、类#方法、类#成员]
  21. */
  22. public static String encodeStr(String value) {
  23. byte[] enbytes = Base64.encodeBase64Chunked(value.getBytes());
  24. return new String(enbytes);
  25. }
  26. /**
  27. * 加密
  28. *
  29. * @param value
  30. * @return
  31. * @see [类、类#方法、类#成员]
  32. */
  33. public static String encodeStr(byte[] value) {
  34. byte[] enbytes = Base64.encodeBase64Chunked(value);
  35. return new String(enbytes);
  36. }
  37. }