Class SYM_ENCRYPT
- All Implemented Interfaces:
Lifecycle
The secret key is identical for all cluster members and is injected into this protocol at startup, e.g. by reading it from a keystore. Messages are sent by encrypting them with the secret key and received by decrypting them with the secret key. Note that all cluster members must be shipped with the same keystore file
This protocol is typically placed under NAKACK2, so that most important
headers are encrypted as well, to prevent replay attacks.
A possible configuration looks like this:
<SYM_ENCRYPT key_store_name="defaultStore.keystore" store_password="changeit" alias="myKey"/>
In order to use SYM_ENCRYPT layer in this manner, it is necessary to have the secret key already generated in a
keystore file. The directory containing the keystore file must be on the application's classpath. You cannot create a
secret key keystore file using the keytool application shipped with the JDK. A java file called KeyStoreGenerator is
included in the demo package that can be used from the command line (or IDE) to generate a suitable keystore.
- Author:
- Bela Ban, Steve Woodcock
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringstatic final Stringstatic final Stringstatic final Stringprotected Stringprotected Stringprotected Stringprotected StringFields inherited from class Encrypt
asym_algorithm, asym_keylength, cipher_pool_size, decoding_ciphers, DEFAULT_SYM_ALGO, encoding_ciphers, key_map, key_map_max_size, provider, secret_key, secure_random, sym_algorithm, sym_iv_length, sym_keylength, sym_version, viewFields inherited from class Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, preview_warning, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalias()protected InputStreamvoidinit()Called after a protocol has been created and before the protocol is started.protected voidInitialisation if a supplied key is defined in the properties.Sets the key store entry used to configure this protocol.setSecretKey(SecretKey key) storePassword(String pwd) Methods inherited from class Encrypt
_decrypt, asymAlgorithm, asymAlgorithm, asymKeylength, asymKeylength, code, createCipher, decrypt, down, down, encrypt, getAlgorithm, getModeAndPadding, handleEncryptedMessage, handleView, initCipher, initSymCiphers, inView, makeIv, printCachedGroupKeys, secretKey, secureRandom, secureRandom, simIvLength, symAlgorithm, symAlgorithm, symIvLength, symKeyAlgorithm, symKeylength, symKeylength, symVersion, up, up, up, versionMethods inherited from class Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, previewWarning, previewWarning, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, start, statsEnabled, stop, toString
-
Field Details
-
DEFAULT_KEYSTORE_TYPE
- See Also:
-
DEFAULT_KEYSTORE_PASSWORD
- See Also:
-
DEFAULT_KEYSTORE_ALIAS
- See Also:
-
keystore_name
-
keystore_type
-
store_password
-
key_password
-
alias
-
-
Constructor Details
-
SYM_ENCRYPT
public SYM_ENCRYPT()
-
-
Method Details
-
keystoreName
-
keystoreName
-
alias
-
alias
-
storePassword
-
storePassword
-
setKeyStoreEntry
Description copied from class:EncryptSets the key store entry used to configure this protocol.- Specified by:
setKeyStoreEntryin classEncrypt<KeyStore.SecretKeyEntry>- Parameters:
entry- a key store entry
-
setSecretKey
-
init
Description copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent. -
readSecretKeyFromKeystore
-
getKeyStoreSource
- Throws:
FileNotFoundException
-