Top Description Inners Constructors Methods
com.mysql.cj.util

public Class SaslPrep

extends Object
Class Inheritance
Imports
java.text.Normalizer, .Normalizer.Form, com.mysql.cj.exceptions.ExceptionFactory, .WrongArgumentException

Implementation for SASLprep: Stringprep Profile for User Names and Passwords, as specified in RFC 4013.
See Also
RFC 3454

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
SaslPrep.StringType

The type of string usage regarding the support for unassigned code points as described in RFC 3454, Section 7.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static boolean

Returns:

true if the character is one of the ASCII control characters, false otherwise.
isAsciiControlCharacter
(char
the character to check.
chr
)

Prohibited Output: ASCII control characters [StringPrep, C.2.1].

private static boolean

Returns:

true if the character is one of the LCat characters, false otherwise.
isBidiLCat
(int
the code point of the character to check.
cp
)

Bidirectional Characters: LCat characters.

private static boolean

Returns:

true if the character is one of the RandALCat characters, false otherwise.
isBidiRAndAlCat
(int
the code point of the character to check.
cp
)

Bidirectional Characters: RandALCat characters.

private static boolean

Returns:

true if the character is one of the change display properties or deprecated characters, false otherwise.
isChangeDisplayPropertiesOrDeprecatedCharacter
(char
the character to check.
chr
)

Prohibited Output: change display properties or deprecated characters [StringPrep, C.8].

private static boolean

Returns:

true if the character is one of the inappropriate for canonical representation characters, false otherwise.
isInappropriateForCanonicalRepresentationCharacter
(char
the character to check.
chr
)

Prohibited Output: inappropriate for canonical representation characters [StringPrep, C.7].

private static boolean

Returns:

true if the character is one of the inappropriate for plain text characters, false otherwise.
isInappropriateForPlainTextCharacter
(char
the character to check.
chr
)

Prohibited Output: inappropriate for plain text characters [StringPrep, C.6].

private static boolean

Returns:

true if the character is one of the "commonly mapped to nothing" characters, false otherwise.
isMappeableToNothing
(char
the character to check.
chr
)

Mapping: the "commonly mapped to nothing" characters [StringPrep, B.1] that can be mapped to nothing.

private static boolean

Returns:

true if the character is one of the non-ASCII control characters, false otherwise.
isNonAsciiControlCharacter
(int
the code point of the character to check.
cp
)

Prohibited Output: non-ASCII control characters [StringPrep, C.2.2].

private static boolean

Returns:

true if the character is one of the non-ASCII space characters, false otherwise.
isNonAsciiSpaceChar
(char
the character to check.
chr
)

Mapping: non-ASCII space characters [StringPrep, C.1.2] that can be mapped to SPACE (U+0020).

private static boolean

Returns:

true if the character is one of the non-character code points, false otherwise.
isNonCharacterCodePoint
(int
the code point of the character to check.
cp
)

Prohibited Output: non-character code points [StringPrep, C.4].

private static boolean

Returns:

true if the character is one of the private use characters, false otherwise.
isPrivateUseCharacter
(int
the code point of the character to check.
cp
)

Prohibited Output: private use characters [StringPrep, C.3].

private static boolean

Returns:

true if the character is prohibited according to the profile rules, false otherwise.
isProhibited
(char
the character to check.
chr
,
int
the code point of the character to check.
cp
)

Checks if the given character is one of the prohibited characters under the "SASLprep Profile" rules.

private static boolean

Returns:

true if the character is one of the surrogate code points, false otherwise.
isSurrogateCode
(char
the character to check.
chr
)

Prohibited Output: surrogate code points [StringPrep, C.5].

private static boolean

Returns:

true if the character is one of the tagging characters, false otherwise.
isTaggingCharacter
(int
the code point of the character to check.
cp
)

Prohibited Output: tagging characters [StringPrep, C.9].

private static boolean

Returns:

true if the character is unassigned, false otherwise.
isUnassigned
(int
the code point of the character to check.
cp
)

Unassigned Code Points: list of unassigned code points.

private static String

Returns:

a normalized version of the given string by the rules of the Unicode normalization form KC.
normalizeKc
(CharSequence
the string to be normalized.
str
)

Normalization: Unicode normalization form KC.

public static String

Returns:

the prepared version of the given string.
prepare
(String
the string to prepare.
str
,
SaslPrep.StringType
the type of preparation with regard to the support for unassigned code points.
sType
)

Prepares the given string by applying the "SASLprep" profile of the "stringprep" algorithm.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SaslPrepback to summary
public SaslPrep()

Method Detail

isAsciiControlCharacterback to summary
private static boolean isAsciiControlCharacter(char chr)

Prohibited Output: ASCII control characters [StringPrep, C.2.1].

Parameters
chr:char

the character to check.

Returns:boolean

true if the character is one of the ASCII control characters, false otherwise.

isBidiLCatback to summary
private static boolean isBidiLCat(int cp)

Bidirectional Characters: LCat characters. See also RFC 3454, Section 6

Parameters
cp:int

the code point of the character to check.

Returns:boolean

true if the character is one of the LCat characters, false otherwise.

isBidiRAndAlCatback to summary
private static boolean isBidiRAndAlCat(int cp)

Bidirectional Characters: RandALCat characters. See also RFC 3454, Section 6

Parameters
cp:int

the code point of the character to check.

Returns:boolean

true if the character is one of the RandALCat characters, false otherwise.

isChangeDisplayPropertiesOrDeprecatedCharacterback to summary
private static boolean isChangeDisplayPropertiesOrDeprecatedCharacter(char chr)

Prohibited Output: change display properties or deprecated characters [StringPrep, C.8].

Parameters
chr:char

the character to check.

Returns:boolean

true if the character is one of the change display properties or deprecated characters, false otherwise.

isInappropriateForCanonicalRepresentationCharacterback to summary
private static boolean isInappropriateForCanonicalRepresentationCharacter(char chr)

Prohibited Output: inappropriate for canonical representation characters [StringPrep, C.7].

Parameters
chr:char

the character to check.

Returns:boolean

true if the character is one of the inappropriate for canonical representation characters, false otherwise.

isInappropriateForPlainTextCharacterback to summary
private static boolean isInappropriateForPlainTextCharacter(char chr)

Prohibited Output: inappropriate for plain text characters [StringPrep, C.6].

Parameters
chr:char

the character to check.

Returns:boolean

true if the character is one of the inappropriate for plain text characters, false otherwise.

isMappeableToNothingback to summary
private static boolean isMappeableToNothing(char chr)

Mapping: the "commonly mapped to nothing" characters [StringPrep, B.1] that can be mapped to nothing.

Parameters
chr:char

the character to check.

Returns:boolean

true if the character is one of the "commonly mapped to nothing" characters, false otherwise.

isNonAsciiControlCharacterback to summary
private static boolean isNonAsciiControlCharacter(int cp)

Prohibited Output: non-ASCII control characters [StringPrep, C.2.2].

Parameters
cp:int

the code point of the character to check.

Returns:boolean

true if the character is one of the non-ASCII control characters, false otherwise.

isNonAsciiSpaceCharback to summary
private static boolean isNonAsciiSpaceChar(char chr)

Mapping: non-ASCII space characters [StringPrep, C.1.2] that can be mapped to SPACE (U+0020).

Parameters
chr:char

the character to check.

Returns:boolean

true if the character is one of the non-ASCII space characters, false otherwise.

isNonCharacterCodePointback to summary
private static boolean isNonCharacterCodePoint(int cp)

Prohibited Output: non-character code points [StringPrep, C.4].

Parameters
cp:int

the code point of the character to check.

Returns:boolean

true if the character is one of the non-character code points, false otherwise.

isPrivateUseCharacterback to summary
private static boolean isPrivateUseCharacter(int cp)

Prohibited Output: private use characters [StringPrep, C.3].

Parameters
cp:int

the code point of the character to check.

Returns:boolean

true if the character is one of the private use characters, false otherwise.

isProhibitedback to summary
private static boolean isProhibited(char chr, int cp)

Checks if the given character is one of the prohibited characters under the "SASLprep Profile" rules.

Parameters
chr:char

the character to check.

cp:int

the code point of the character to check.

Returns:boolean

true if the character is prohibited according to the profile rules, false otherwise.

See Also
RFC 4013, Section 2.3
isSurrogateCodeback to summary
private static boolean isSurrogateCode(char chr)

Prohibited Output: surrogate code points [StringPrep, C.5].

Parameters
chr:char

the character to check.

Returns:boolean

true if the character is one of the surrogate code points, false otherwise.

isTaggingCharacterback to summary
private static boolean isTaggingCharacter(int cp)

Prohibited Output: tagging characters [StringPrep, C.9].

Parameters
cp:int

the code point of the character to check.

Returns:boolean

true if the character is one of the tagging characters, false otherwise.

isUnassignedback to summary
private static boolean isUnassigned(int cp)

Unassigned Code Points: list of unassigned code points. See also RFC 3454, Section 7.

Note that this implementation does not check exactly the unassigned code points as specified in the RFC since it is based on Java's Unicode support, which is updated regularly while the specification is based on a static list of code points. This should have no major impact, though.

Parameters
cp:int

the code point of the character to check.

Returns:boolean

true if the character is unassigned, false otherwise.

normalizeKcback to summary
private static String normalizeKc(CharSequence str)

Normalization: Unicode normalization form KC.

Parameters
str:CharSequence

the string to be normalized.

Returns:String

a normalized version of the given string by the rules of the Unicode normalization form KC.

prepareback to summary
public static String prepare(String str, SaslPrep.StringType sType)

Prepares the given string by applying the "SASLprep" profile of the "stringprep" algorithm.

Parameters
str:String

the string to prepare.

sType:SaslPrep.StringType

the type of preparation with regard to the support for unassigned code points.

Returns:String

the prepared version of the given string.

See Also
RFC 4013, RFC 3454
com.mysql.cj.util back to summary

public final Enum SaslPrep.StringType

extends Enum<SaslPrep.StringType>
Class Inheritance

The type of string usage regarding the support for unassigned code points as described in RFC 3454, Section 7.

Field Summary

Modifier and TypeField and Description
public static final SaslPrep.StringType
QUERY

Queries for matching strings MAY contain unassigned code points.

public static final SaslPrep.StringType
STORED

Stored strings using the profile MUST NOT contain any unassigned code points.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static SaslPrep.StringType
public static SaslPrep.StringType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

QUERYback to summary
public static final SaslPrep.StringType QUERY

Queries for matching strings MAY contain unassigned code points.

STOREDback to summary
public static final SaslPrep.StringType STORED

Stored strings using the profile MUST NOT contain any unassigned code points.

Constructor Detail

StringTypeback to summary
private StringType()

Method Detail

valueOfback to summary
public static SaslPrep.StringType valueOf(String name)
valuesback to summary
public static SaslPrep.StringType[] values()