Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Encryption Decryption In Scriptlets/Java

Ads

 
 

Share on Google+Share on Google+

Anthony Maniquiz
Encryption Decryption In Scriptlets/Java
0 Answer(s)      5 years and 4 months ago
Posted in : Java Beginners

I have this code in my scriptlet, when I use the Encryption code to encrypt my data it executes successfully, now when I get my encrypted data from my DB, specifically MSSQL.. I traced where the program stopped working and it stopped in the decryption part and I get this error.. "Given Final Block not properly padded".. can anyway help me here? Thanks in Advance.. Here's the code..

byte[] encryptKey = "This is a test DESede key".getBytes();

DESedeKeySpec spec = new DESedeKeySpec(encryptKey);

SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");

SecretKey theKey = keyFactory.generateSecret(spec);

Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");

IvParameterSpec ivParameters = new IvParameterSpec(new byte[] { 12, 34, 56, 78, 90, 87, 65, 43 } );
cipher.init(Cipher.DECRYPT_MODE, theKey, ivParameters);

System.out.println("Get Encrypted Data from db");
String fName = (String)session.getAttribute("first_name");
String lName = (String)session.getAttribute("last_name");

System.out.println("Convert Encrypted Data to Byte Format");
byte[] FirstName = new byte[(int)fName.length()];
byte[] LastName = new byte[(int)lName.length()];

// Decrypt the data
System.out.println("Decrypt Byte Converted Data");
byte[] DecryptedFirstName = cipher.doFinal(FirstName);
byte[] DecryptedLastName = cipher.doFinal(LastName);
Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Encryption Decryption In Scriptlets/Java
Encryption Decryption In Scriptlets/Java  I have this code in my scriptlet, when I use the Encryption code to encrypt my data it executes... where the program stopped working and it stopped in the decryption part and I get
encryption and decryption
encryption and decryption  how to encrypt and decrypt data in text file
Advertisements
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
encryption and decryption
encryption and decryption   ASCII encryptor I want to develop a program that encrypt and decrypt. The messages stored in a file should.... This is called encryption. When one wants to read the contents of the file
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
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
decryption and encryption - Java Beginners
decryption and encryption  hi everyone. my question is that i have one problem which i have to solve and the issue is that i have to do the encryption and decryption thing there in my code, e.g if the user enters the abc the code
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
Encryption and Decryption - Java Beginners
Encryption and Decryption  Hello sir, i need Password encryption and decryption program using java program. I dont know how to write the program... the source code of encyption and decryption using java. Thanking you... 
encryption and decryption - Java Beginners
encryption and decryption  i need files encryption and decryption program using java. but i dont know how to write the program.pls help me thank you so much  Hi Friend, Try the following code: import java.io.
Password encryption and decryption
Password encryption and decryption  Hello, I'm developing a system that requires user to login to enter the system. so I wanted to store encrypted users' password in the database so that I wouldnt know their password
Sample code for An ASCII Encryption and Decryption code in C-language only.
Sample code for An ASCII Encryption and Decryption code in C-language only... code for this project including both the encryption and decryption aspects... stored in a file. This is called encryption. When one wants to read the contents
JSP Encryption - JSP-Servlet
JSP Encryption  Hi! Please give me code for MD5 encryption & decryption. Thanks in advance
AES decryption in Java
AES decryption in Java   AES decryption in Java with password.../viewqa/Java-Beginners/26020-AES-Decryption-using-key-password-.html    http://www.roseindia.net/answers/viewqa/Java-Beginners/26020-AES-Decryption
sound encryption
sound encryption  i want to ask if there is a simple code to perform encryption on sound file
password encryption in php - PHP
password encryption in php  example of password encryption in php
What are encryption functions in PHP?
What are encryption functions in PHP?  What are encryption functions in PHP
AES encryption in J2ME
AES encryption in J2ME  Is it possible to do aes encryption in j2me
Version of com.braintreepayments>encryption dependency
List of Version of com.braintreepayments>encryption dependency
Encryption code - JSP-Servlet
Encryption code  Iam developing a web security application for that reason i need a code of encryption in servlet. Can u please send it to me.Its very urgent Because my project delivery date is very near
AES Decryption using key password
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
Encryption In Swing - Swing AWT
Encryption In Swing  Hi sir i have a JFrame Containing User Name and Password is there any way to encrypt password and how can we store the encrypted passwaord to MS ACCESS
Maven Dependency encryption >> 2.1.0
You should include the dependency code given in this page to add Maven Dependency of com.braintreepayments >> encryption version2.1.0 in your project
Maven Dependency encryption >> 2.0.0
You should include the dependency code given in this page to add Maven Dependency of com.braintreepayments >> encryption version2.0.0 in your project
Version of com.amazonaws>aws-dynamodb-encryption-java dependency
List of Version of com.amazonaws>aws-dynamodb-encryption-java dependency
Version of com.amazonaws>aws-encryption-sdk-java dependency
List of Version of com.amazonaws>aws-encryption-sdk-java dependency
Version of com.cloudant>cloudant-sync-datastore-android-encryption dependency
List of Version of com.cloudant>cloudant-sync-datastore-android-encryption dependency
Java Encryption using AES with key password
Java Encryption using AES with key password    /* AES alogrithm...); } }    /* AES encryption alogrithm in JAVA */ /* AES alogrithm... string: " + output); } }    /* AES encryption alogrithm in JAVA
Open Source Encryption
Open Source Encryption Open Source encryption module loses FIPS... certification of the open-source encryption tool OpenSSL under the Federal Information... Layer encryption that can be used by browsers and other programs to securely