org.jgroups.protocols
public abstract class EncryptBase extends Protocol
SYM_ENCRYPT
) and asymmetric (ASYM_ENCRYPT
) encryption protocols.Modifier and Type | Field and Description |
---|---|
protected String |
asym_algorithm |
protected int |
asym_keylength |
protected int |
cipher_pool_size |
protected BlockingQueue<Cipher> |
decoding_ciphers |
protected static String |
DEFAULT_SYM_ALGO |
protected BlockingQueue<Cipher> |
encoding_ciphers |
protected boolean |
encrypt_entire_message |
protected Map<AsciiString,Cipher> |
key_map |
protected Address |
local_addr |
protected String |
provider |
protected SecretKey |
secret_key |
protected boolean |
sign_msgs |
protected String |
sym_algorithm |
protected int |
sym_keylength |
protected byte[] |
sym_version |
protected boolean |
use_adler |
protected View |
view |
Constructor and Description |
---|
EncryptBase() |
Modifier and Type | Method and Description |
---|---|
protected Message |
_decrypt(Cipher cipher,
Message msg,
EncryptHeader hdr) |
boolean |
adler() |
<T extends EncryptBase> |
adler(boolean flag) |
String |
asymAlgorithm() |
<T extends EncryptBase> |
asymAlgorithm(String alg) |
int |
asymKeylength() |
<T extends EncryptBase> |
asymKeylength(int len) |
protected byte[] |
code(byte[] buf,
int offset,
int length,
boolean decode) |
protected long |
computeChecksum(byte[] input,
int offset,
int length) |
protected Checksum |
createChecksummer() |
protected Cipher |
createCipher(int mode,
SecretKey secret_key,
String algorithm) |
protected long |
decryptChecksum(Cipher cipher,
byte[] input,
int offset,
int length) |
protected Message |
decryptMessage(Cipher cipher,
Message msg)
Does the actual work for decrypting - if version does not match current cipher then tries the previous cipher
|
Object |
down(Event evt)
An event is to be sent down the stack.
|
protected void |
encryptAndSend(Message msg) |
protected byte[] |
encryptChecksum(long checksum) |
boolean |
encryptEntireMessage() |
<T extends EncryptBase> |
encryptEntireMessage(boolean b) |
protected static String |
getAlgorithm(String s) |
protected Object |
handleEncryptedMessage(Message msg) |
protected void |
handleUnknownVersion()
Called when the version shipped in the header can't be found
|
protected Object |
handleUpEvent(Message msg,
EncryptHeader hdr) |
protected Object |
handleUpMessage(Message msg) |
protected void |
handleView(View view) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
protected void |
initSymCiphers(String algorithm,
SecretKey secret)
Initialises the ciphers for both encryption and decryption using the generated or supplied secret key
|
protected boolean |
inView(Address sender,
String error_msg) |
<T extends EncryptBase> |
localAddress(Address addr) |
protected boolean |
process(Message msg)
Whether or not to process this received message
|
SecretKey |
secretKey() |
<T extends EncryptBase> |
secretKey(SecretKey key) |
boolean |
signMessages() |
<T extends EncryptBase> |
signMessages(boolean flag) |
String |
symAlgorithm() |
<T extends EncryptBase> |
symAlgorithm(String alg) |
int |
symKeylength() |
<T extends EncryptBase> |
symKeylength(int len) |
byte[] |
symVersion() |
<T extends EncryptBase> |
symVersion(byte[] v) |
Object |
up(Event evt)
An event was received from the layer below.
|
String |
version() |
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, resetStats, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, start, statsEnabled, stop
protected static final String DEFAULT_SYM_ALGO
protected String provider
protected String asym_algorithm
protected String sym_algorithm
protected int asym_keylength
protected int sym_keylength
protected int cipher_pool_size
protected boolean encrypt_entire_message
protected boolean sign_msgs
protected boolean use_adler
protected volatile Address local_addr
protected volatile View view
protected BlockingQueue<Cipher> encoding_ciphers
protected BlockingQueue<Cipher> decoding_ciphers
protected volatile byte[] sym_version
protected volatile SecretKey secret_key
protected final Map<AsciiString,Cipher> key_map
public int asymKeylength()
public <T extends EncryptBase> T asymKeylength(int len)
public int symKeylength()
public <T extends EncryptBase> T symKeylength(int len)
public SecretKey secretKey()
public <T extends EncryptBase> T secretKey(SecretKey key)
public String symAlgorithm()
public <T extends EncryptBase> T symAlgorithm(String alg)
public String asymAlgorithm()
public <T extends EncryptBase> T asymAlgorithm(String alg)
public byte[] symVersion()
public <T extends EncryptBase> T symVersion(byte[] v)
public <T extends EncryptBase> T localAddress(Address addr)
public boolean encryptEntireMessage()
public <T extends EncryptBase> T encryptEntireMessage(boolean b)
public boolean signMessages()
public <T extends EncryptBase> T signMessages(boolean flag)
public boolean adler()
public <T extends EncryptBase> T adler(boolean flag)
public String version()
public void init() throws Exception
Protocol
public Object down(Event evt)
Protocol
down_prot.down()
. In case of a GET_ADDRESS event (which tries to
retrieve the stack's address from one of the bottom layers), the layer may need to send
a new response event back up the stack using up_prot.up()
.public Object up(Event evt)
Protocol
down_prot.down()
or c) the event (or another event) is sent up
the stack using up_prot.up()
.protected void initSymCiphers(String algorithm, SecretKey secret) throws Exception
Exception
protected Cipher createCipher(int mode, SecretKey secret_key, String algorithm) throws Exception
Exception
protected Object handleEncryptedMessage(Message msg) throws Exception
Exception
protected Object handleUpEvent(Message msg, EncryptHeader hdr)
protected boolean process(Message msg)
protected void handleView(View view)
protected Checksum createChecksummer()
protected Message decryptMessage(Cipher cipher, Message msg) throws Exception
Exception
protected Message _decrypt(Cipher cipher, Message msg, EncryptHeader hdr) throws Exception
Exception
protected byte[] code(byte[] buf, int offset, int length, boolean decode) throws Exception
Exception
protected long computeChecksum(byte[] input, int offset, int length)
protected long decryptChecksum(Cipher cipher, byte[] input, int offset, int length) throws Exception
Exception
protected void handleUnknownVersion()
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.