But how to write the encryption code and decryption code, dont worry we no need to write the long lines code, we can use open source code for encryption and decryption given by Query Crypt.
Just follow the sample to encrypt the data.
<%@ page import="com.guhesan.querycrypt.QueryCrypt" %>To do the decryption just go through the below code.
<%
String plainString = "BankID=1234&AccountID=J5678&TrasactionID=25";
String encryptedS = QueryCrypt.getInstance().encrypt(request, plainString);
%>
A HREF="<%=request.getContextPath()%>/URL_U_WANT_TO_GO.jsp?<%=encryptedS%>">Click here for the secure transaction /A
Suppose you had a encrypted string such as the following:
someURL.jsp?_tq=c95a29f62075cf63028be5ec6ba48be0
To decrypt in JSP:
<%@ page import="com.guhesan.querycrypt.QueryCrypt" %>You can now use the methods available in the RequestParameterObject to get the name value pairs.
<%@ page import="com.guhesan.querycrypt.beans.RequestParameterObject" %>
<%
RequestParameterObject rpo = QueryCrypt.getInstance().decrypt(request);
%>
The following methods are available for RequestParameterObject:
java.util.Map RequestParameterObject.getParameterMap();
java.lang.String RequestParameterObject.getParameter(java.lang.String name);
java.util.Enumeration RequestParameterObject.getParameterNames();
java.lang.String[] RequestParameterObject.getParameterValues(java.lang.String name);
String RequestParameterObject.toString();
Source URL: http://www.avedatech.com/Products/QueryCrypt/index.jsp
you can download source files, jar files related to query crypt.
No comments:
Post a Comment