public class DH_KEY_EXCHANGE extends KeyExchange
Modifier and Type | Class and Description |
---|---|
static class |
DH_KEY_EXCHANGE.DhHeader |
protected static class |
DH_KEY_EXCHANGE.Type |
Modifier and Type | Field and Description |
---|---|
protected PublicKey |
dh_key
The public key used for the Diffie-Hellman key exchange to obtain the session key (used to encrypt the
keyserver's secret key)
|
protected static KeyFactory |
dh_key_factory |
protected KeyAgreement |
key_agreement
Diffie-Hellman protocol engine
|
protected static KeyPairGenerator |
key_pair_gen |
protected long |
last_key_request
Time (ms) when the last key request was sent, prevents too many requests
|
protected String |
secret_key_algorithm |
protected int |
secret_key_length |
protected long |
timeout |
local_addr
after_creation_hook, down_prot, ergonomics, id, log, stack, stats, up_prot
Constructor and Description |
---|
DH_KEY_EXCHANGE() |
Modifier and Type | Method and Description |
---|---|
void |
fetchSecretKeyFrom(Address target)
Needs to fetch the secret key from a given destination (usually the key server).
|
protected void |
handle(DH_KEY_EXCHANGE.DhHeader hdr,
Address sender) |
protected void |
handleSecretKeyRequest(PublicKey dh_public_key,
Address sender) |
protected void |
handleSecretKeyResponse(PublicKey dh_public_key,
byte[] encrypted_secret_key,
byte[] version,
Address sender) |
protected SecretKey |
hash(byte[] key) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
protected static String |
print16(PublicKey pub_key) |
Object |
up(Message msg)
A single message was received.
|
void |
up(MessageBatch batch)
Sends up a multiple messages in a
MessageBatch . |
down, findProtocolAbove, getSecretKeyFromAbove, handleView, providedUpServices, requiredUpServices, setSecretKeyAbove
accept, afterCreationHook, destroy, down, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, providedDownServices, requiredDownServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setProtocolStack, setSocketFactory, setUpProtocol, setValue, start, statsEnabled, stop, up
protected String secret_key_algorithm
protected int secret_key_length
protected long timeout
protected KeyAgreement key_agreement
protected PublicKey dh_key
protected long last_key_request
protected static final KeyPairGenerator key_pair_gen
protected static final KeyFactory dh_key_factory
public void init() throws Exception
Protocol
public void fetchSecretKeyFrom(Address target) throws NoSuchAlgorithmException, InvalidKeyException
KeyExchange
KeyExchange.setSecretKeyAbove(Tuple)
.fetchSecretKeyFrom
in class KeyExchange
target
- The member from which to fetch the secret keyNoSuchAlgorithmException
InvalidKeyException
public Object up(Message msg)
Protocol
public void up(MessageBatch batch)
Protocol
MessageBatch
. The sender of the batch is always the same, and so is the
destination (null == multicast messages). Messages in a batch can be OOB messages, regular messages, or mixed
messages, although the transport itself will create initial MessageBatches that contain only either OOB or
regular messages.
The default processing below sends messages up the stack individually, based on a matching criteria
(calling Protocol.accept(org.jgroups.Message)
), and - if true - calls Protocol.up(org.jgroups.Event)
for that message and removes the message. If the batch is not empty, it is passed up, or else it is dropped.
Subclasses should check if there are any messages destined for them (e.g. using
MessageBatch.getMatchingMessages(short,boolean)
), then possibly remove and process them and finally pass
the batch up to the next protocol. Protocols can also modify messages in place, e.g. ENCRYPT could decrypt all
encrypted messages in the batch, not remove them, and pass the batch up when done.protected void handle(DH_KEY_EXCHANGE.DhHeader hdr, Address sender)
protected void handleSecretKeyRequest(PublicKey dh_public_key, Address sender) throws Exception
Exception
protected void handleSecretKeyResponse(PublicKey dh_public_key, byte[] encrypted_secret_key, byte[] version, Address sender) throws Exception
Exception
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.