com.atlassian.security.random
Class DefaultSecureTokenGenerator
java.lang.Object
com.atlassian.security.random.DefaultSecureTokenGenerator
- All Implemented Interfaces:
- SecureTokenGenerator
public final class DefaultSecureTokenGenerator
- extends Object
- implements SecureTokenGenerator
Implementation of SecureTokenGenerator which uses the DefaultSecureRandomService
for random byte generation.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static SecureTokenGenerator getInstance()
- Returns:
- shared
DefaultSecureTokenGenerator instance.
generateToken
public String generateToken()
- Generates a hexadecimal
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.
- Specified by:
generateToken in interface SecureTokenGenerator
- Returns:
- returns a hexadecimal encoded representation of 20 random bytes.
- See Also:
generateToken()
Copyright © 2013 Atlassian. All rights reserved.