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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


zzq
Stream Cipher
0 Answer(s)      3 years and 8 months ago
Posted in : Java Beginners


I want to encrypt data use two layer cipher as follow,but it seems not work, why and how, thanks´╝?

encrypt part´╝? Cipher cf1 = Cipher.getInstance(ciphAlg1); cf1.init(Cipher.ENCRYPT_MODE, key1, paramSpec); Cipher cf2 = Cipher.getInstance(ciphAlg2); cf2.init(Cipher.ENCRYPT_MODE, key2, paramSpec2);

FileInputStream fis = new FileInputStream(inputFile); FileOutputStream fos = new FileOutputStream(outputFile); CipherOutputStream cos1 = new CipherOutputStream(fos, cf1); CipherOutputStream cos2 = new CipherOutputStream(cos1, cf2);

decrypt part´╝? Cipher cf1 = Cipher.getInstance(ciphAlg1); cf1.init(Cipher.DECRYPT_MODE, key1, paramSpec); Cipher cf2 = Cipher.getInstance(ciphAlg2); cf2.init(Cipher.DECRYPT_MODE, key2, paramSpec2);

FileInputStream fis = new FileInputStream(inputFile); FileOutputStream fos = new FileOutputStream(outputFile);

CipherOutputStream cos1 = new CipherOutputStream(fos, cf2); CipherOutputStream cos2 = new CipherOutputStream(cos1, cf1);

One layer work well, but the double...


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Stream Cipher
Stream Cipher  I want to encrypt data use two layer cipher as follow,but it seems not work, why and how, thanks´╝? encrypt part´╝? Cipher cf1 = Cipher.getInstance(ciphAlg1); cf1.init(Cipher.ENCRYPT_MODE, key1, paramSpec); Cipher
Java Stream
Java Stream   What is Stream and Types
Advertisements
a competitive study on cryptography techniques over block cipher
a competitive study on cryptography techniques over block cipher  i need "a competitive study on cryptography techniques over block cipher" project source code... plz reply to my post... for more information about this project
Byte ? Oriented Stream and Character- Oriented Stream
Byte ? Oriented Stream and Character- Oriented Stream  difference between Byte ? Oriented Stream and Character- Oriented Stream
Byte ? Oriented Stream and Character- Oriented Stream
Byte ? Oriented Stream and Character- Oriented Stream  Difference between Byte ? Oriented Stream and Character- Oriented Stream
php stream functions
php stream functions  what does php stream functions do
Data input & output Stream
Data input & output Stream  Explain Data Input Stream and Data Output Stream Class.   DataInputStream and DataOutputStream A data input stream lets an application read primitive Java data types from an underlying input
I/O stream class.
I/O stream class.  Explain the hierarchy of Java I/O stream class.   Hierarchy of Java I/O streams Have a look at the following link: Java I/O
Java I/O stream
Java I/O stream  What class allows you to read objects directly from a stream
Compressed (ZLIB) Input Stream
Compressed (ZLIB) Input Stream  I have to make call to a web service which will send a compressed (ZLIB) stream back to me. I have to de-compress the same stream and use it further. My problem is that I have to get it done
Java Stream Write Exception
Java Stream Write Exception  I am doing socket programming. I have two files called Server.java and client.java. Both programs were running successfully and successfully sending data to each other. Yesterday I added the following
stream length not specified - Java Beginners
stream length not specified  our requirement is we need to send the audio data that is spoken by the client to the server and save it in a file. when we r using servlet applet technology we r getting stream length not specified
Java error stream
Java error stream       The Java error stream is used to print error that arises during... to the different stream that allows the user to move them to different pages
Java write to stream
Java write to stream       Following example demonstrates, how to write data in to the stream... to write data in to the underlying character stream. In the example to write, data
Stream Result example
Stream Result example Stream Result is very important for allowing users... of the input stream property. contentLength - It is the Stream length in byte...;. contentDisposition - It is used for specifying file name. An Example of Stream
J2ME -- Stream video from a udp server - MobileApplications
J2ME -- Stream video from a udp server  HI, I wanted to develope a mobile application in j2ME to stream video from a udp server by providing the Ip address of the server and the port no. to connect to and using the UDP protocol
java byte stream array - Java Beginners
java byte stream array  I have a byte array that contains hexadecimal data for eg byte[] testMessage = {0x02, // STX 0x31,0x32,0x10,0x02,0x33, // Data 31 32 02 33
Reading XML Data from a Stream
Reading XML Data from a Stream       This Example shows you how to Read XML Data via a Stream in a DOM...;Stream.  * ReadingXmlDataFromStream.java   
retrive image from database using jsp without stream
retrive image from database using jsp without stream  How to retrive image from database using jsp without stream like (inputStream
How to convert Input Stream to String in java
How to convert Input Stream to String in java The InputStream class is the base class of all input streams in the Java IO API. It is used for reading byte... returns -1, there is no more data to read in the stream. This value is stored
Convert Inputstream to OutputStream
understand the conversion of an input stream into an output stream by taking an example. In this example we are taking a file as input stream and also creating an object of output stream. To convert an input stream
Convert InputStream to Byte
stream to byte. Here we are going to read input stream and converting it into bytes. To do so first read the input stream from dos prompt then store... : This is used to take the input stream .The System class provides references
Java I/O Examples
the stream, byte stream and array of byte stream. Classes... reading from an underlying stream.. Apart from this, it allows the user to make a chain using multiple input stream so that, the operations
Convert InputStream to ByteArray
stream into a byte array. To convert the InputStream... can store file into InputStream to take the file as input stream. To convert the input stream into string we use toString() method
Java Byte Streams Example
at a time from the input stream. To read the input stream as byte streams.... All the classes that represents the input stream of bytes are the subclasses... the stream. The close() method of this class has no effect i.e. after closing
Read the File
that lets you read characters from a stream and stores it in an internal buffer. Lets... stream. The input stream is a file "Filterfile.txt" from which...);      // Now read the buffered stream
Serializable Exception
; is transmitted through the network in the encoded stream of byte form. This Encoded form can be reconstructed from the network by reading from byte of stream... classes are not serializable, the object stream methods will 
Serialization in java
to the stream, a object can be represented as sequence of byte. While writing the state of object to the stream it includes object type as well as type of data stored...) throws IOException : This method write the object state into the stream. Likewise
What is the use of BufferedReader in Java program?
the file/input stream (source stream). With help of InputStreamReader you can read the data into character stream. The InputStreamReader class reads the bytes from stream and then decode into characters. The InputStreamReader class uses
How to write a file in Java?
data into output stream. It is used for writing character files. By default... that allows data writing in output stream in various ways. Some... buffer to character-output stream. Data can be single characters, arrays
Advertisements
 

 

 

DMCA.com