public class CodeVerifierUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CODE_VERIFIER_ENTROPY
The default entropy (in bytes) used for the code verifier.
|
static int |
MAX_CODE_VERIFIER_ENTROPY
The maximum permitted entropy (in bytes) for use with
generateRandomCodeVerifier(SecureRandom,int) . |
static int |
MAX_CODE_VERIFIER_LENGTH
The maximum permitted length for a code verifier.
|
static int |
MIN_CODE_VERIFIER_ENTROPY
The minimum permitted entropy (in bytes) for use with
generateRandomCodeVerifier(SecureRandom,int) . |
static int |
MIN_CODE_VERIFIER_LENGTH
The minimum permitted length for a code verifier.
|
Modifier and Type | Method and Description |
---|---|
static void |
checkCodeVerifier(String codeVerifier)
Throws an IllegalArgumentException if the provided code verifier is invalid, as
defined by the PKCE specification
(Section 4.1).
|
static String |
deriveCodeVerifierChallenge(String codeVerifier)
Produces a challenge from a code verifier, using SHA-256 as the challenge method if the
system supports it (all Android devices should support SHA-256), and falls back
to the
"plain" challenge type if
unavailable. |
static String |
generateRandomCodeVerifier()
Generates a random code verifier string using
SecureRandom as the source of
entropy, with the default entropy quantity as defined by
DEFAULT_CODE_VERIFIER_ENTROPY . |
static String |
generateRandomCodeVerifier(SecureRandom entropySource,
int entropyBytes)
Generates a random code verifier string using the provided entropy source and the specified
number of bytes of entropy.
|
static String |
getCodeVerifierChallengeMethod()
|
public static final int MIN_CODE_VERIFIER_LENGTH
public static final int MAX_CODE_VERIFIER_LENGTH
public static final int DEFAULT_CODE_VERIFIER_ENTROPY
public static final int MIN_CODE_VERIFIER_ENTROPY
generateRandomCodeVerifier(SecureRandom,int)
.public static final int MAX_CODE_VERIFIER_ENTROPY
generateRandomCodeVerifier(SecureRandom,int)
.public static void checkCodeVerifier(String codeVerifier)
public static String generateRandomCodeVerifier()
SecureRandom
as the source of
entropy, with the default entropy quantity as defined by
DEFAULT_CODE_VERIFIER_ENTROPY
.public static String generateRandomCodeVerifier(SecureRandom entropySource, int entropyBytes)
public static String deriveCodeVerifierChallenge(String codeVerifier)
"plain" challenge type
if
unavailable.public static String getCodeVerifierChallengeMethod()