|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.owasp.esapi.codecs.Codec
public abstract class Codec
The Codec interface defines a set of methods for encoding and decoding application level encoding schemes, such as HTML entity encoding and percent encoding (aka URL encoding). Codecs are used in output encoding and canonicalization. The design of these codecs allows for character-by-character decoding, which is necessary to detect double-encoding and the use of multiple encoding schemes, both of which are techniques used by attackers to bypass validation and bury encoded attacks in data.
Encoder
Constructor Summary | |
---|---|
Codec()
Default constructor |
Method Summary | |
---|---|
static boolean |
containsCharacter(char c,
char[] array)
Utility to search a char[] for a specific char. |
String |
decode(String input)
Decode a String that was encoded using the encode method in this Class |
Character |
decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString. |
String |
encode(char[] immune,
String input)
Encode a String so that it can be safely used in a specific context. |
String |
encodeCharacter(char[] immune,
Character c)
Default implementation that should be overridden in specific codecs. |
static String |
getHexForNonAlphanumeric(char c)
Lookup the hex value of any character that is not alphanumeric. |
static String |
toHex(char c)
|
static String |
toOctal(char c)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Codec()
Method Detail |
---|
public String encode(char[] immune, String input)
immune
- input
- the String to encode
public String encodeCharacter(char[] immune, Character c)
immune
- c
- the Character to encode
public String decode(String input)
input
- the String to decode
public Character decodeCharacter(PushbackString input)
input
- the Character to decode
public static String getHexForNonAlphanumeric(char c)
c
- The character to lookup.public static String toOctal(char c)
public static String toHex(char c)
public static boolean containsCharacter(char c, char[] array)
c
- array
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |