Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet servelt -jsp Encryption Decryption Code
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Munaganti Veera Anilkumar
servelt -jsp Encryption Decryption Code
1 Answer(s)      3 years and 11 months ago
Posted in : JSP-Servlet


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 urgent Because my project delivery date is very near


Advertisement
View Answers

February 15, 2011 at 10:49 AM


import java.io.*;
import java.security.*;
import javax.crypto.*;

class EncryptAndDecrypt {

public static void main (String[] args) throws Exception{
KeyPairGenerator keygenerator = KeyPairGenerator.getInstance("RSA");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
keygenerator.initialize(1024, random);

KeyPair keypair = keygenerator.generateKeyPair();
PrivateKey privateKey = keypair.getPrivate();
PublicKey publicKey = keypair.getPublic();
Cipher cipher = Cipher.getInstance("RSA");

cipher.init(Cipher.ENCRYPT_MODE, publicKey);
String st= "roseindia";
byte[] cleartext = null;
cleartext = st.getBytes();
byte[] ciphertext = null;
ciphertext = cipher.doFinal(cleartext);
System.out.println("the encrypted text is: " + ciphertext.toString());

cipher.init(Cipher.DECRYPT_MODE, privateKey);
byte[] cleartext1 = cipher.doFinal(ciphertext);
System.out.println("the decrypted cleartext is: " + new String(cleartext1));
}
}

make a package and import it into servlet or write this code in servlet directly also take care have a nice day



Related Tutorials/Questions & Answers:
encryption and decryption
encryption and decryption  how to encrypt and decrypt data in text file
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
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
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
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
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 - Java Beginners
the source code of encyption and decryption using java. Thanking you... ...Encryption and Decryption  Hello sir, i need Password encryption and decryption program using java program. I dont know how to write the program
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.
Encryption Decryption
Encryption Decryption  I want to store a type string to my database... want to retrieve it in it's decrypted format. I am using JSP's, I want to encrypt user input on one jsp and retrieve it, decrypted, on another jsp for viewing
Password encryption and decryption
Password encryption and decryption  Hello, I'm developing a system... then you can use the decrypt function, created in the jsp. 1)form.jsp: <...; For the above code, we have create a database table: CREATE TABLE `user
stegnography code
stegnography code  code for the digital stegnographic technique for the encryption and decryption of image
servelt refresh page
servelt refresh page   write a program in servlet that display the cricket score.the page should automatically refresh on every 5 seconds.the score should add on every refresh.the total over is 5.on every 30 seconds the wicket
sound encryption
sound encryption  i want to ask if there is a simple code to perform encryption on sound file
AES decryption in Java
AES decryption in Java   AES decryption in Java with password...-Decryption-using-key-password-.html    http://www.roseindia.net/answers/viewqa/Java-Beginners/26020-AES-Decryption-using-key-password-.html   
AES encryption in J2ME
AES encryption in J2ME  Is it possible to do aes encryption in j2me
What are encryption functions in PHP?
What are encryption functions in PHP?  What are encryption functions in PHP
password encryption in php - PHP
password encryption in php  example of password encryption in php
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
J2ME code hint - MobileApplications
J2ME code hint  I am required to make a mobile application for encryption and decryption of sms messages using RSA. The last day for submission is 9th of March, 2009... If anyone can plz help me in this regard plz let me
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
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
Java Encryption using AES with key password
Java Encryption using AES with key password    /* AES alogrithm... This is my String"; // password for encryption final static String strPassword...); } }    /* AES encryption alogrithm in JAVA */ /* AES alogrithm
code
code  code for android sample program
code
code    how to write this in java
Code
Code  code for connecting c lang to database
code for this is
code for this is  a b c d c b a a b c c b a a b b a a a code
code
code  please provide code for custom tags.by using currdate tag we need to get current date?please give me code
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
Advertisements
 

 

 

DMCA.com