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

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:
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 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  how to encrypt and decrypt data in text 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 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
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
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   
sound encryption
sound encryption  i want to ask if there is a simple code to perform encryption on sound file
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
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
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
ModuleNotFoundError: No module named 'Encryption'
ModuleNotFoundError: No module named 'Encryption'  Hi, My Python... 'Encryption' How to remove the ModuleNotFoundError: No module named 'Encryption' error? Thanks   Hi, In your python environment you
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
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
Version of com.braintreepayments>encryption dependency
List of Version of com.braintreepayments>encryption dependency
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
ModuleNotFoundError: No module named 'aws-encryption'
ModuleNotFoundError: No module named 'aws-encryption'  Hi, My... named 'aws-encryption' How to remove the ModuleNotFoundError: No module named 'aws-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cred-encryption'
ModuleNotFoundError: No module named 'cred-encryption'  Hi, My... named 'cred-encryption' How to remove the ModuleNotFoundError: No module named 'cred-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'py-encryption'
ModuleNotFoundError: No module named 'py-encryption'  Hi, My... 'py-encryption' How to remove the ModuleNotFoundError: No module named 'py-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aws-encryption'
ModuleNotFoundError: No module named 'aws-encryption'  Hi, My... named 'aws-encryption' How to remove the ModuleNotFoundError: No module named 'aws-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cred-encryption'
ModuleNotFoundError: No module named 'cred-encryption'  Hi, My... named 'cred-encryption' How to remove the ModuleNotFoundError: No module named 'cred-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dynamodb-encryption'
ModuleNotFoundError: No module named 'dynamodb-encryption'  Hi, My... named 'dynamodb-encryption' How to remove the ModuleNotFoundError: No module named 'dynamodb-encryption' error? Thanks   Hi
ModuleNotFoundError: No module named 'ska-encryption'
ModuleNotFoundError: No module named 'ska-encryption'  Hi, My... named 'ska-encryption' How to remove the ModuleNotFoundError: No module named 'ska-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'aws-encryption'
ModuleNotFoundError: No module named 'aws-encryption'  Hi, My... named 'aws-encryption' How to remove the ModuleNotFoundError: No module named 'aws-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cred-encryption'
ModuleNotFoundError: No module named 'cred-encryption'  Hi, My... named 'cred-encryption' How to remove the ModuleNotFoundError: No module named 'cred-encryption' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'dynamodb-encryption'
ModuleNotFoundError: No module named 'dynamodb-encryption'  Hi, My... named 'dynamodb-encryption' How to remove the ModuleNotFoundError: No module named 'dynamodb-encryption' error? Thanks   Hi
Maven Dependency aws-dynamodb-encryption-java >> 1.11.0
You should include the dependency code given in this page to add Maven Dependency of com.amazonaws >> aws-dynamodb-encryption-java version1.11.0 in your project
Maven Dependency aws-encryption-sdk-java >> 0.0.1
You should include the dependency code given in this page to add Maven Dependency of com.amazonaws >> aws-encryption-sdk-java version0.0.1 in your project
Code
Code  code for connecting c lang to database
code
code    how to write this in java
code
code  code for android sample program
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:ADS_TO_REPLACE_1 import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import

Ads