Class CryptFilter
java.lang.Object
org.apache.sshd.common.filter.IoFilter
org.apache.sshd.common.session.filters.CryptFilter
- All Implemented Interfaces:
Filter, Owned<FilterContext>, CryptStatisticsProvider
A filter that decrypts incoming packets and encrypts outgoing ones.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum padding length we use.static final intAn arbitrary constant >= the largest authentication tag size we will ever have. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRetrieves the input counters.longRetrieves the current input sequence number.longRetrieves the previous input sequence number.Retrieves the output counters.longRetrieves the current output sequence number.in()Retrieves the filter'sInputHandler.booleanisSecure()Tells whether the connection is secure: encrypted and having a message authentication code, either via an explicit MAC or as part of an AEAD cipher.out()Retrieves the filter'sOutputHandler.voidvoidvoidvoidsetInput(CryptFilter.Settings settings, boolean resetSequence) voidsetOutput(CryptFilter.Settings settings, boolean resetSequence) voidsetRandom(org.apache.sshd.common.random.Random random) voidsetSession(Session session)
-
Field Details
-
MAX_PADDING
public static final int MAX_PADDINGThe maximum padding length we use. RFC 4253: at least 4 bytes padding, at most 255 bytes.Keep the padding size <= 127, though: JSch has a bug where it reads the pad byte as a signed value when compression is used!
- See Also:
-
MAX_TAG_LENGTH
public static final int MAX_TAG_LENGTHAn arbitrary constant >= the largest authentication tag size we will ever have.- See Also:
-
-
Constructor Details
-
CryptFilter
public CryptFilter()
-
-
Method Details
-
setRandom
public void setRandom(org.apache.sshd.common.random.Random random) -
setSession
-
in
Description copied from interface:FilterRetrieves the filter'sInputHandler.- Specified by:
inin interfaceFilter- Returns:
- the
InputHandleror codenullif this filter is an output-only filter
-
out
Description copied from interface:FilterRetrieves the filter'sOutputHandler.- Specified by:
outin interfaceFilter- Returns:
- the
OutputHandleror codenullif this filter is an input-only filter
-
resetInputCounters
public void resetInputCounters() -
resetOutputCounters
public void resetOutputCounters() -
getInputCounters
Description copied from interface:CryptStatisticsProviderRetrieves the input counters.- Specified by:
getInputCountersin interfaceCryptStatisticsProvider- Returns:
- the input counters
-
getOutputCounters
Description copied from interface:CryptStatisticsProviderRetrieves the output counters.- Specified by:
getOutputCountersin interfaceCryptStatisticsProvider- Returns:
- the output counters
-
setInput
-
setOutput
-
getInputSettings
-
getOutputSettings
-
getLastInputSequenceNumber
public long getLastInputSequenceNumber()Description copied from interface:CryptStatisticsProviderRetrieves the previous input sequence number.This is the sequence number of the last received packet.
- Specified by:
getLastInputSequenceNumberin interfaceCryptStatisticsProvider- Returns:
- the sequence number as an unsigned 32bit value.
-
getInputSequenceNumber
public long getInputSequenceNumber()Description copied from interface:CryptStatisticsProviderRetrieves the current input sequence number.This is the sequence number expected for the next packet.
- Specified by:
getInputSequenceNumberin interfaceCryptStatisticsProvider- Returns:
- the sequence number as an unsigned 32bit value.
-
getOutputSequenceNumber
public long getOutputSequenceNumber()Description copied from interface:CryptStatisticsProviderRetrieves the current output sequence number.This is the sequence number for the next packet.
- Specified by:
getOutputSequenceNumberin interfaceCryptStatisticsProvider- Returns:
- the sequence number as an unsigned 32bit value.
-
isSecure
public boolean isSecure()Description copied from interface:CryptStatisticsProviderTells whether the connection is secure: encrypted and having a message authentication code, either via an explicit MAC or as part of an AEAD cipher.- Specified by:
isSecurein interfaceCryptStatisticsProvider- Returns:
- whether the connection is secure
-
addEncryptionListener
-
removeEncryptionListener
-