byte[] cipherData = Base64.encodeBase64(plainText.getBytes()); //默認不換行 byte[] cipherData = Base64.encodeBase64(plainText.getBytes(), false); //取消換行 byte[] cipherData = Base64.encodeBase64Chunked(plainText.getBytes()); //進行換行 String cipherText = Base64.encodeBase64String(plainText.getBytes()); //轉爲字符串 2. 安全的url:轉換+爲-、/爲_、將多餘的=去掉 Java代碼 byte[] cipherData = Base64.encodeBase64(plainText.getBytes(), false, true); byte[] cipherData = Base64.encodeBase64URLSafe(plainText.getBytes()); String cipherText = Base64.encodeBase64URLSafeString(plainText.getBytes());