/** * Encode string value into Base64 format. * * @param string string to encode. * @return given <code>string</code> value encoded Base64. */ public static String encode(String string) { try { return encode(string.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new BugError("JVM with missing support for UTF-8."); } }
write(Base64.encode(encryptedMessage)); } catch (InvalidKeyException | NoSuchPaddingException | BadPaddingException | IllegalBlockSizeException e) {