AES Decryption using key password
/* Decrypt using AES with password */
/* developed by Nishanth Thomas - Insolutions Global Pvt Ltd Bangalore */
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Decoder;
public class testDecrypt {
/* Mode = CipherMode.CBC,-( Cipher-block chaining)
Padding = PaddingMode.PKCS7 or PKCS5,
KeySize = 128,
BlockSize = 128,
Key = keyBytes,
IV = keyBytes */
Cipher cipher;
// Input encrypted String
static String input = "sw0SrUIKe0DmS7sRd9+XMgtYg+BUiAfiOsdMw/Lo2RA=";
// password to decrypt 16 bit
final static String strPassword = "password12345678";
// put this as key in AES
static SecretKeySpec key = new SecretKeySpec(strPassword.getBytes(), "AES");
public static void main(String args []) throws Exception{
AlgorithmParameterSpec paramSpec = new IvParameterSpec(strPassword.getBytes());
//Whatever you want to encrypt/decrypt using AES /CBC padding
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
//You can use ENCRYPT_MODE or DECRYPT_MODE
cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
//decode data using standard decoder
byte[] output = new BASE64Decoder().decodeBuffer(input);
// Decrypt the data
byte[] decrypted = cipher.doFinal(output);
System.out.println("Original string: " +
new String(input));
// decryptedData .;
System.out.println("Decrypted string: " +
new String(decrypted));
}
}
View Answers
May 22, 2012 at 11:26 AM
/* Decrypt using AES with password */
/* developed by Nishanth Thomas - Insolutions Global Pvt Ltd Bangalore */
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Decoder;
public class testDecrypt {
/* Mode = CipherMode.CBC,-( Cipher-block chaining)
Padding = PaddingMode.PKCS7 or PKCS5,
KeySize = 128,
BlockSize = 128,
Key = keyBytes,
IV = keyBytes */
Cipher cipher;
// Input encrypted String
static String input = "sw0SrUIKe0DmS7sRd9+XMgtYg+BUiAfiOsdMw/Lo2RA=";
// password to decrypt 16 bit
final static String strPassword = "password12345678";
// put this as key in AES
static SecretKeySpec key = new SecretKeySpec(strPassword.getBytes(), "AES");
public static void main(String args []) throws Exception{
AlgorithmParameterSpec paramSpec = new IvParameterSpec(strPassword.getBytes());
//Whatever you want to encrypt/decrypt using AES /CBC padding
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
//You can use ENCRYPT_MODE or DECRYPT_MODE
cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
//decode data using standard decoder
byte[] output = new BASE64Decoder().decodeBuffer(input);
// Decrypt the data
byte[] decrypted = cipher.doFinal(output);
System.out.println("Original string: " +
new String(input));
// decryptedData .;
System.out.println("Decrypted string: " +
new String(decrypted));
}
}
Ads
Related Tutorials/Questions & Answers:
AES Decryption using key password
AES Decryption using key password /* Decrypt
using AES...; /* Decrypt
using AES with
password */
/* developed by Nishanth...";
// put this as
key in
AES
static SecretKeySpec
key = new SecretKeySpec
Java Encryption using AES with key password
Java Encryption
using AES with
key password /*
AES alogrithm
using password key */
/* developed by Nishanth Thomas Insolutions Global Pvt... */
/*
AES alogrithm
using password key */
/* developed by Nishanth Thomas
Advertisements
AES decryption in Java
-
Decryption-
using-
key-
password-.html
http://www.roseindia.net/answers/viewqa/Java-Beginners/26020-AES-
Decryption-
using-
key-
password-.html
 ...
AES decryption in Java
AES decryption in Java with
password
Password encryption and decryption
Password encryption and decryption Hello, I'm developing a system... users'
password in the database so that I wouldnt know their
password. Is there anyway that you could teach me how to encrypt the
password and store
encrypt the username and password using PHP
encrypt the username and
password using PHP How can we encrypt the username and
password using PHP?
Hi friends,
You can use the MySQL
PASSWORD() function to encrypt username and
password. For example,
INSERT
code for password strength using jsp-servlet
code for
password strength
using jsp-servlet hi..............
plz help me to give code for
password strength
using jsp-servlet
for implementation in my project as soon as possible because i want to show this functionality in my
encryption and decryption of files
encryption and
decryption of files Please can any one provide me with the code for encryption and
decryption of files
using RSA algorithm.
I want to use a browse option to search for the file which is needed for encryption
Change root password of MYSQL using Java
Change root
password of MYSQL
using Java
In this tutorial, you will learn how to change the root
password of MYSQL
database
using java code.
For every..., the system administrator user is called root. You can also set the new
password using
how to check username & password from database using jsp
how to check username &
password from database
using jsp Hello,
I have created 1 html page which contain username,
password & submit button.
in my oracle10G database already contain table name admin which has name,
password
How to handle the text using Key Listener Interface
How to handle the text
using Key Listener Interface... to handle the text
using the
key events
on the Java Awt component. All the
key events... are going to show you how to
display the text of textField1 on the text field2 on
key
Encryption Decryption In Scriptlets/Java
Encryption
Decryption In Scriptlets/Java I have this code in my... where the program stopped working and it stopped in the
decryption part and I get... DESede
key".getBytes();
DESedeKeySpec spec = new DESedeKeySpec(encryptKey
Encryption Decryption
Encryption Decryption I want to store a type string to my database, specifically MSSQL, I want the stored data in the database to be encrypted and I want to retrieve it in it's decrypted format.
I am
using JSP's, I want
Password
Password make a program which ask ask the username and
password * in this format.
in C language
ModuleNotFoundError: No module named 'aes'
ModuleNotFoundError: No module named '
aes' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
aes'
How to remove the ModuleNotFoundError: No module named '
aes' error
servelt -jsp Encryption Decryption Code
servelt -jsp Encryption
Decryption Code Encryption code&
Decryption code Iam developing a web security application for that reason i need a code of encryption &
Decryption in servlet. Can u please send it to me.Its very
part of AES code in JSP
part of
AES code in JSP org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 19 in the jsp file...;
}
}
writer.println("Enter
password:");
inp
ModuleNotFoundError: No module named 'aes-vial'
ModuleNotFoundError: No module named '
aes-vial' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
aes-vial'
How to remove the ModuleNotFoundError: No module named '
aes-vial
ModuleNotFoundError: No module named 'aes-vial'
ModuleNotFoundError: No module named '
aes-vial' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
aes-vial'
How to remove the ModuleNotFoundError: No module named '
aes-vial
ModuleNotFoundError: No module named 'easy-aes'
ModuleNotFoundError: No module named 'easy-
aes' Hi,
My Python... 'easy-
aes'
How to remove the ModuleNotFoundError: No module named 'easy-
aes... to install padas library.
You can install easy-
aes python with following
ModuleNotFoundError: No module named 'simp-AES'
ModuleNotFoundError: No module named 'simp-
AES' Hi,
My Python... 'simp-
AES'
How to remove the ModuleNotFoundError: No module named 'simp-
AES... to install padas library.
You can install simp-
AES python with following