|
||||||||||
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. |
java.lang.String |
decode(java.lang.String input)
Decode a String that was encoded using the encode method in this Class |
java.lang.Character |
decodeCharacter(PushbackString input)
Returns the decoded version of the next character from the input string and advances the current character in the PushbackString. |
java.lang.String |
encode(char[] immune,
java.lang.String input)
Encode a String so that it can be safely used in a specific context. |
java.lang.String |
encodeCharacter(char[] immune,
java.lang.Character c)
Default implementation that should be overridden in specific codecs. |
static java.lang.String |
getHexForNonAlphanumeric(char c)
Lookup the hex value of any character that is not alphanumeric. |
static java.lang.String |
toHex(char c)
|
static java.lang.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 java.lang.String encode(char[] immune, java.lang.String input)
immune
- input
- the String to encode
public java.lang.String encodeCharacter(char[] immune, java.lang.Character c)
immune
- c
- the Character to encode
public java.lang.String decode(java.lang.String input)
input
- the String to decode
public java.lang.Character decodeCharacter(PushbackString input)
input
- the Character to decode
public static java.lang.String getHexForNonAlphanumeric(char c)
c
- The character to lookup.public static java.lang.String toOctal(char c)
public static java.lang.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 |