public class EncryptInterceptor extends ChannelInterceptorBase implements EncryptInterceptorMBean
setEncryptionKey(byte[])
or the hex-encoded binary bytes by calling
setEncryptionKey(String)
.ChannelInterceptor.InterceptorEvent
Modifier and Type | Field and Description |
---|---|
protected static StringManager |
sm |
optionFlag
Constructor and Description |
---|
EncryptInterceptor() |
Modifier and Type | Method and Description |
---|---|
String |
getEncryptionAlgorithm()
Gets the encryption algorithm being used to encrypt and decrypt channel
messages.
|
byte[] |
getEncryptionKey()
Gets the encryption key being used for encryption and decryption.
|
String |
getEncryptionKeyString() |
String |
getProviderName()
Gets the JCA provider name used for cryptographic activities.
|
void |
messageReceived(ChannelMessage msg)
the
messageReceived is invoked when a message is received. |
void |
sendMessage(Member[] destination,
ChannelMessage msg,
InterceptorPayload payload)
The
sendMessage method is called when a message is being sent to one more destinations. |
void |
setEncryptionAlgorithm(String algorithm)
Sets the encryption algorithm to be used for encrypting and decrypting
channel messages.
|
void |
setEncryptionKey(byte[] key)
Sets the encryption key for encryption and decryption.
|
void |
setEncryptionKey(String keyBytes)
Gets the encryption key being used for encryption and decryption.
|
void |
setEncryptionKeyString(String encryptionKeyString) |
void |
setProviderName(String provider)
Sets the JCA provider name used for cryptographic activities.
|
void |
start(int svc)
Starts up the channel.
|
void |
stop(int svc)
Shuts down the channel.
|
accept, fireInterceptorEvent, getChannel, getLocalMember, getMember, getMembers, getNext, getOptionFlag, getPrevious, hasMembers, heartbeat, memberAdded, memberDisappeared, okToProcess, setChannel, setNext, setOptionFlag, setPrevious
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOptionFlag, setOptionFlag
protected static final StringManager sm
public void start(int svc) throws ChannelException
ChannelInterceptorBase
start
in interface ChannelInterceptor
start
in class ChannelInterceptorBase
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
public void stop(int svc) throws ChannelException
ChannelInterceptorBase
stop
in interface ChannelInterceptor
stop
in class ChannelInterceptorBase
svc
- int value of ChannelException
- if a startup error occurs or the service is already started.Channel
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException
ChannelInterceptor
sendMessage
method is called when a message is being sent to one more destinations.
The interceptor can modify any of the parameters and then pass on the message down the stack by
invoking getNext().sendMessage(destination,msg,payload)
getNext().sendMessage(destination,msg,payload)
sendMessage
in interface ChannelInterceptor
sendMessage
in class ChannelInterceptorBase
destination
- Member[] - the destination for this messagemsg
- ChannelMessage - the message to be sentpayload
- InterceptorPayload - the payload, carrying an error handler and future useful data, can be nullChannelException
- if a serialization error happens.ErrorHandler
,
InterceptorPayload
public void messageReceived(ChannelMessage msg)
ChannelInterceptor
messageReceived
is invoked when a message is received.
ChannelMessage.getAddress()
is the sender, or the reply-to address
if it has been overwritten.messageReceived
in interface ChannelInterceptor
messageReceived
in class ChannelInterceptorBase
msg
- ChannelMessagepublic void setEncryptionAlgorithm(String algorithm)
algorithm/mode/padding
.
Information on standard algorithm names may be found in the
Java
documentation.
Default is AES/CBC/PKCS5Padding
.setEncryptionAlgorithm
in interface EncryptInterceptorMBean
algorithm
- The algorithm to use.public String getEncryptionAlgorithm()
getEncryptionAlgorithm
in interface EncryptInterceptorMBean
public void setEncryptionKey(byte[] key)
setEncryptionKey
in interface EncryptInterceptorMBean
key
- The encryption key.public void setEncryptionKey(String keyBytes)
0xab
will be shown as "ab". The length of the string in characters will
be twice the length of the key in bytes.keyBytes
- The encryption key.public byte[] getEncryptionKey()
getEncryptionKey
in interface EncryptInterceptorMBean
public String getEncryptionKeyString()
public void setEncryptionKeyString(String encryptionKeyString)
public void setProviderName(String provider)
setProviderName
in interface EncryptInterceptorMBean
provider
- The name of the JCA provider.public String getProviderName()
getProviderName
in interface EncryptInterceptorMBean
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.