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



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

Have Programming Question? Ask it here!
 
 
 


Munaganti Veera Anilkumar
servelt -jsp Encryption Decryption Code
1 Answer(s)      3 years and 8 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
sound encryption
sound encryption  i want to ask if there is a simple code to perform encryption on sound file
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
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
code
the correct code for a program.The output of the program is listed below...: {Block 5} ADDRESS-3: {San Juan} POST CODE:{6745} ENTER CODE (XX TO stop) CODE:{FF1} QUANTITY:{2} CODE:{TR4} QUANTITY:{1} CODE:XX INVOICE FOR YOUR ORDER Harry
code
code to create the RMI client on the local machine: import java.rmi.*; public... : "+e); } } } However, when the preceding code is executed it results... the correct code
code
code  i have four textboxes.whenever i click on up,down,left or down arrows then the cursor move to another textbox based on the key pressed.i want code for this in javascript
code
line of code to print the amount he should be paid as allowance
code
code  write a program to encrypt and decrypt the cipher text "adfgvx"   Hi Friend, Try the following code: import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import java.io.
ajax code
ajax code  Explain me this code function disp_branch(val... not support HTTP Request") return } var url="index.php?q=<?php echo $this->date_format->encryption('Query','load_branchunit');?>
JAVA code For
JAVA code For   JAVA code For "Traffic signals Identification for vehicles
Code
Code  how to print this?? with the use of only JSP....... 1 23 456 78910   Here is the jsp number pattern example: 1 2 3 4 5 6 7 8 9 10 <%@page language="java"%> <% int k = 1; for(int i=1; i<= 4 ;i
c code
c code  c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 end code for this   c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 can any one end code
example code
example code  code for displaying a list from another class on a midlet
Code for a triangle.....
Code for a triangle.....   1 1 5 1 1 5 25 5 1 What is the source Code for above output
c code
c code  c code for this formula x=(y-0.22z-072)4; where y=7.32 x=3.1 then ans x=23.9 end code
JSF code
need jsf code that will populate combo box values from the database  Hi, i'm new on JSf,I need jsf code that will populate combo box values from the database when the form runs
Code for Pattern
Code for Pattern   * * * * * * * * Please write the code of above program and please do not use in this string tokennizer, string buffer etc i mean to say that please use very simple method
Code for Pattern
Code for Pattern   * * * * * * * * * * * Please write the code of above program and please do not use in this string tokennizer, string buffer etc i mean to say that please use very simple method
Advertisements
 

 

 

DMCA.com