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());