Package de.das.encrypter.cryptoservice
Class CryptoServer
java.lang.Object
de.das.encrypter.cryptoservice.CryptoServer
- All Implemented Interfaces:
DataReceiver,ResultReceiver,ActionListener,EventListener
Keys can be requested via this server. It receives requests consisting of an
encrypted string containing a key ID and the desired length of the key
separated by a semicolon. If a key with this ID is available and it is
possible to provide the required length, the server starts sending a key
block by block.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final intFields inherited from interface de.das.encrypter.processors.ResultReceiver
PARTNER_RESPONSE, RESULT_STRINGS, TRANSFER_BREAK, TRANSFER_FAILED, TRANSFER_VALID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidReceiver of an action event in case of a time out situation.static voidcreateInstance(KeyFiles kfs, int port, EntryPointSupplier eps) static LongReturns the current ID of the key used for encryption of requests and keys.static voidnewPort(int port) Changes the port where the crypto service is offered.static voidsetCryptoKeyId(Long id) Sets the ID of the key bundle to be used to encrypt the key part to be returned based on the request.voidsetData(byte[] data) Unused interface methode.voidReceives data and checks if the data length is smaller than 80 bytes, the data is encrypted, if the required key for decryption is available and if a "crypto key ID" has been set for the encryption of the key to be sent.voidThe result information coming from the transfer control instance.
-
Field Details
-
RESPONSE_ID
- See Also:
-
RESPONSE_ID_LENGTH
public static final int RESPONSE_ID_LENGTH -
NO_REJECTION
public static final int NO_REJECTION- See Also:
-
KEY_UNKNOWN
public static final int KEY_UNKNOWN- See Also:
-
KEYS_TOO_SHORT
public static final int KEYS_TOO_SHORT- See Also:
-
NO_UNUSED_KEY_AVAILABLE
public static final int NO_UNUSED_KEY_AVAILABLE- See Also:
-
-
Constructor Details
-
CryptoServer
- Throws:
Exception
-
-
Method Details
-
createInstance
- Throws:
Exception
-
setCryptoKeyId
Sets the ID of the key bundle to be used to encrypt the key part to be returned based on the request.- Parameters:
id- the ID of a key bundle.
-
getCryptoKeyId
Returns the current ID of the key used for encryption of requests and keys.- Returns:
-
newPort
public static void newPort(int port) Changes the port where the crypto service is offered.- Parameters:
port- the new port number.
-
setData
public void setData(byte[] data) Unused interface methode.- Specified by:
setDatain interfaceDataReceiver- Parameters:
data-
-
setData
Receives data and checks if the data length is smaller than 80 bytes, the data is encrypted, if the required key for decryption is available and if a "crypto key ID" has been set for the encryption of the key to be sent. If these conditions are met, the received data will be passed for decryption and if executable to start the broadcast. If one of these conditions is not met, the request is ignored.- Specified by:
setDatain interfaceDataReceiver- Parameters:
host- the IP-address of the receiver.data- received data via UDP service receiver.
-
actionPerformed
Receiver of an action event in case of a time out situation.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- an action event.
-
setResult
The result information coming from the transfer control instance.- Specified by:
setResultin interfaceResultReceiver- Parameters:
result- an integer with information whether a transfer was successful or failed.info- an optional and additional information text.
-