common:encrypt / common:decrypt

These tags lets you encrypt / decrypt a string. Very useful for hiding information from the user and still being able to transfer it between pages etc. We use it heavily in contact forms so email addresses are hidden.

Parameters

Name Required Default Type Description
id true   String The result is stored in this variable.
value true   Object/String The string we want to encode.
         


ID-result variable contains: A String-object.

Examples

<%@ taglib uri="infoglue-common" prefix="common" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<common:encrypt id="encryptedString" value="This is a string we wish to
encrypt"/>
Encrypted string: <c:out value="${encryptedString}"/><br/>
This will result in that the variable "encryptedString" will contain an MD5-encrypted string.

Below is an example of how to decrypt it. The server keeps the encryption key to itself.

<%@ taglib uri="infoglue-common" prefix="common" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<common:decrypt id="decryptedString" value="${encryptedString}"/>
Decrypted string: <c:out value="${decryptedString}"/><br/>
This will result in that the variable "decryptedString" will contain the cleartext string again.



comments powered by Disqus