|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessage.Padder
final class Padder
Adds or removes padding to / from a message (Padding is used to guarantee a
constant message length and therefore prevent linkability). Uses a
pseudo-random number Generator (SecureRandom
) for generating
padding.
This class is thread-safe.
Field Summary | |
---|---|
private static java.security.SecureRandom |
secureRandom
Random number generator for padding. |
Constructor Summary | |
---|---|
private |
Padder()
Empty constructor. |
Method Summary | |
---|---|
protected static byte[] |
addPadding(byte[] data,
int desiredLength)
Increases the size of the bypassed array to desiredLength ,
filling it's unused space with padding. |
protected static byte[] |
removePadding(byte[] data,
int lengthOfUnpaddedData)
Removes padding from the bypassed array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.security.SecureRandom secureRandom
Constructor Detail |
---|
private Padder()
Method Detail |
---|
protected static byte[] addPadding(byte[] data, int desiredLength)
desiredLength
,
filling it's unused space with padding. If desiredLength
is
larger than the bypassed array, no actions are performed (since padding
is not necessary).
data
- Array to be padded to desiredLength
.desiredLength
- Desired length of the bypassed array after padding
in byte.protected static byte[] removePadding(byte[] data, int lengthOfUnpaddedData)
lengthOfUnpaddedData
is smaller than the bypassed array, no actions are performed
(since the bypassed array contains no padding).
data
- Array with padding.lengthOfUnpaddedData
- Desired length of the bypassed array after
removal of padding.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |