Click here to Skip to main content
15,437,709 members
Articles / Programming Languages / Java / Java SE / J2EE
Posted 5 Aug 2017

Tagged as


12 bookmarked

Anoncrypt-Text Encryption and Decryption Website in Java (Struts2)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
5 Aug 2017CPOL2 min read
Anoncrypt by HTCoders is a web-based Text Encryption and Decryption Project developed using Java Technology following Struts2 Framework


Anoncrypt by HTCoders is a service for securing text messages in an easy way. It could encrypt your message using strong encryption algorithms, so it will be more secure to send or store, than in plain text. Anyone who will get access to the encrypted message will be unable to read the original message without knowing your password.

Most of our communication channels can be easily accessed by third-parties, not only government and your internet provider, but even by your friends and family (if we're talking about social networks or your personal computer).

Using Anoncrypt, you could encrypt sensitive information with secure AES cipher, so nobody will get access to it without knowing the original password.


In this modern world, unauthorized persons are trying to mine data/view the data illegally.

This project will allow only authorized person to view the data who knows the secret key. So, unauthorized persons will be restricted to some extent.

Module 1: Symmetric Key Algorithm

Symmetric key algorithms are algorithms for cryptographic keys for both encryption of plaintext and decryption of cipher text. The keys may be identical or there may be a simple transformation to go between the two keys. The keys, in practice, represent a shared secret between two or more parties that can be used to maintain a private information link. Symmetric key algorithms are algorithms for cryptography that use the same

Module 2: Self-Destructive Messaging Service

This module is mainly constructed with the idea of providing data security. In this module, the user is provided a textbox to input his data to encipher it and a password. After entering the data in the input field and his password, the user can encrypt it. As the user enters the encrypt button, the user will be provided a link without which the recipient will not be able to decrypt it. This link can be used only once and after using it, the message will be automatically destroyed, that is why it is also called as “Self Destructible Messaging System”.

Modules of Anoncrypt

Design: High level Architecture


Use Case

Image 2

Class Digram

Image 3

Image 4


1. Screenshot of Home Page

Image 5

2. Password-based Encryption

Image 6 Image 7

3. Access Denied

Image 8

4. Self-Destructive Message Service

Image 9

Sample Source Code


import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class SymAES
    private static final String ALGORITHM = "AES";
    private static byte[] keyValue= new byte[] { 'T', 'h', 'i', 
    's', 'I', 's', 'A', 'S', 'e', 
    'c', 'r', 'e', 't', 'K', 'e', 'y' };    

 public  String encode(String valueToEnc) throws Exception {
     System.out.println("The Key byte value"+keyValue );
    Key key = generateKey();
    Cipher c = Cipher.getInstance(ALGORITHM);
    c.init(Cipher.ENCRYPT_MODE, key);
    byte[] encValue = c.doFinal(valueToEnc.getBytes());
    String encryptedValue = new BASE64Encoder().encode(encValue);
    return encryptedValue;

public  String decode(String encryptedValue) throws Exception {
    Key key = generateKey();
    Cipher c = Cipher.getInstance(ALGORITHM);
    c.init(Cipher.DECRYPT_MODE, key);
    byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedValue);
    byte[] decValue = c.doFinal(decordedValue);
    String decryptedValue = new String(decValue);
    return decryptedValue;
   catch(Exception e)
       String decryptedValue = new String("no");
        return decryptedValue;

private static Key generateKey() throws Exception {
    System.out.println("The Key byte value inside genkey"+keyValue );
    Key key = new SecretKeySpec(keyValue, ALGORITHM);
    return key;
public  void start(String passcode)throws Exception
    int temp=passcode.length();
    for(int i=temp;i<32;i++)
    System.out.println("Updated byte "+passcode);
         keyValue = passcode.getBytes();
    System.out.println("The Key byte value inside start"+keyValue );


Here is the link for the Presentation related to project:


  • 6th May, 2015: Initial version

This project was developed when I was a student at University of Allahabad, India.


For further queries, please visit


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Student University of Allahabad
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

Questionregarding doubts in execution Pin
Member 1342847725-Sep-17 3:25
MemberMember 1342847725-Sep-17 3:25 
AnswerRe: regarding doubts in execution Pin
Rishabh Upadhyay26-Sep-17 8:32
MemberRishabh Upadhyay26-Sep-17 8:32 
GeneralThanks for the sharing the source code Pin
Member 1199343417-Sep-15 21:53
MemberMember 1199343417-Sep-15 21:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.