Package de.das.encrypter.examples
Class CryptoServiceUser
java.lang.Object
de.das.encrypter.examples.CryptoServiceUser
- All Implemented Interfaces:
DataReceiver,ActionListener,EventListener
This example requests a key from the Encrypter-X crypto service, encrypts an
image, and writes it back encrypted to a file. The requested and used key is
in memory only for a short time and only during use. After running this
example, the encrypted file can be viewed using the Encrypter-X browser
function.
The requirements for running this example are that the Encrypter-X is running on this or another machine, its crypto service is configured (port is defined), the Encrypter-X and this example know the same keyring, and this example knows the IP address of the crypto service's home (usually localhost="127.0.0.1").
The requirements for running this example are that the Encrypter-X is running on this or another machine, its crypto service is configured (port is defined), the Encrypter-X and this example know the same keyring, and this example knows the IP address of the crypto service's home (usually localhost="127.0.0.1").
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidIf the crypto service is not available or our request could not be fulfilled, the program will timeout.static voidvoidsetData(byte[] data) Incoming data from the crypto service.voidIncoming data from the crypto service.
-
Constructor Details
-
CryptoServiceUser
Create a new instance of CryptoServiceUser.- Throws:
Exception- if the receiver port is not available.
-
-
Method Details
-
main
-
actionPerformed
If the crypto service is not available or our request could not be fulfilled, the program will timeout.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- an action event.
-
setData
Incoming data from the crypto service.- Specified by:
setDatain interfaceDataReceiver- Parameters:
host- the IP-address of the sender.data- the byte array sent by the sender.
-
setData
public void setData(byte[] data) Incoming data from the crypto service. There can be three different types of messages. It can be a block of the requested data, where the first block initializes the reception, it can be an information why the request was rejected or it is the message that the transmission is finished.- Specified by:
setDatain interfaceDataReceiver- Parameters:
data- the byte array sent by the sender.
-