java8版本base64加密解密

首先,先是加密,这里我使用了base64类

try {
String asB64 = Base64.getEncoder).encodeToString”http://www.baidu.com”.getBytes”utf-8″));
System.out.printlnasB64);
} catch UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace);
}

其次是解密,

byte[] asBytes = Base64.getDecoder).decodeasB64);
System.out.printlnnew StringasBytes, “utf-8”));

Published by

风君子

独自遨游何稽首 揭天掀地慰生平