public final class CodeVerifierUtil
extends java.lang.Object
Generates code verifiers and challenges for PKCE exchange.
| 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(java.lang.String codeVerifier)
Throws an IllegalArgumentException if the provided code verifier is invalid.
|
static java.lang.String |
deriveCodeVerifierChallenge(java.lang.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 java.lang.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 java.lang.String |
generateRandomCodeVerifier(java.security.SecureRandom entropySource,
int entropyBytes)
Generates a random code verifier string using the provided entropy source and the specified
number of bytes of entropy.
|
static java.lang.String |
getCodeVerifierChallengeMethod()
|
public static final int MIN_CODE_VERIFIER_LENGTH
The minimum permitted length for a code verifier.
public static final int MAX_CODE_VERIFIER_LENGTH
The maximum permitted length for a code verifier.
public static final int DEFAULT_CODE_VERIFIER_ENTROPY
The default entropy (in bytes) used for the code verifier.
public static final int MIN_CODE_VERIFIER_ENTROPY
The minimum permitted entropy (in bytes) for use with
generateRandomCodeVerifier(SecureRandom,int).
public static final int MAX_CODE_VERIFIER_ENTROPY
The maximum permitted entropy (in bytes) for use with
generateRandomCodeVerifier(SecureRandom,int).
public static void checkCodeVerifier(java.lang.String codeVerifier)
Throws an IllegalArgumentException if the provided code verifier is invalid.
public static java.lang.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.
public static java.lang.String generateRandomCodeVerifier(java.security.SecureRandom entropySource,
int entropyBytes)
Generates a random code verifier string using the provided entropy source and the specified number of bytes of entropy.
public static java.lang.String deriveCodeVerifierChallenge(java.lang.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.
public static java.lang.String getCodeVerifierChallengeMethod()