File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Help:: how can I do the base64 encoding? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help:: how can I do the base64 encoding? " Watch "Help:: how can I do the base64 encoding? " New topic

Help:: how can I do the base64 encoding?

Zoe Peng
Ranch Hand

Joined: Nov 27, 2000
Posts: 112
How can I do the base64 encoding?
I have username and password from usr input form.
I want to encode these data with base64.
How to approach this? I found out there is a BASE64Encoder in javax.commerce.util package. But, I really don't know how this works. Thakns.

//get usrname and password
String username = request.getParameter("username");
String password = request.getParameter("password");
String userInfo = username + password;

//encoder username and password
BASE64Encoder encoder = new BASE64Encoder();
James Swan
Ranch Hand

Joined: Jun 26, 2001
Posts: 403
Wow, I had a look at the API for that encoder and it is very confusing.
You could try another implementation such as this one.
I agree. Here's the link:
subject: Help:: how can I do the base64 encoding?
Similar Threads
validation and forward
which jar file contains the base64 encoder class to provide basic authentication
Encryption:Generate MD5 hash in Java -Output 16 character
Java Cryptography
Password Encryption