public final class DefaultSecureTokenGenerator extends Object implements SecureTokenGenerator
SecureTokenGenerator which uses the DefaultSecureRandomService
for random byte generation.| Modifier and Type | Method and Description |
|---|---|
String |
generateNonce()
Generates a base64
String representation of 20 random bytes,
produced by DefaultSecureRandomService.nextBytes(byte[]). |
String |
generateToken()
Generates a hexadecimal
String representation of 20 random bytes,
produced by DefaultSecureRandomService.nextBytes(byte[]). |
static SecureTokenGenerator |
getInstance() |
public static SecureTokenGenerator getInstance()
DefaultSecureTokenGenerator instance.public String generateToken()
String representation of 20 random bytes,
produced by DefaultSecureRandomService.nextBytes(byte[]).
The generated String is 40 characters in length and is composed of
characters in the range '0'-'9' and 'a'-'f'.
The length (20 bytes / 160 bits) was selected as it is the same as the size
of the internal state of the SHA1PRNG.generateToken in interface SecureTokenGeneratorgenerateToken()public String generateNonce()
String representation of 20 random bytes,
produced by DefaultSecureRandomService.nextBytes(byte[]).
The length (20 bytes / 160 bits) was selected as it is the same as the size
of the internal state of the SHA1PRNG.generateNonce in interface SecureTokenGeneratorCopyright © 2017 Atlassian. All rights reserved.