public class PasswordUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
VALID_GENERATED_KEY |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
generateKey(int numOfSegments)
Generate a random key.
|
static java.lang.String |
makeSalt(PasswordRecord pr)
Make a new salt value if none already set.
|
static void |
nextBytes(byte[] bytes)
Generates a user-specified number of random bytes.
|
static int |
randomInt(int min,
int max)
Return a random integer within the includes range ( including the minimum/maximum values)
|
static java.lang.String |
randomPassword()
generate a random password.
|
static java.lang.String |
randomPassword(int minLength)
generate a random password.
|
static java.lang.String |
randomPassword(PasswordCreateOption option) |
@RegEx public static final java.lang.String VALID_GENERATED_KEY
public static java.lang.String randomPassword()
public static void nextBytes(byte[] bytes)
If a call to setSeed
had not occurred previously,
the first call to this method forces this SecureRandom object
to seed itself. This self-seeding will not occur if
setSeed
was previously called.
bytes
- the array to be filled in with random bytes.public static java.lang.String randomPassword(int minLength)
minLength
- - minimum lengthpublic static java.lang.String randomPassword(PasswordCreateOption option)
public static int randomInt(int min, int max)
min
- the minimum value.max
- the maximum value (INCLUSIVE)@Nonnull @CheckReturnValue public static java.lang.String generateKey(@Nonnegative int numOfSegments)
numOfSegments
- the number of segments in the generated keypublic static java.lang.String makeSalt(PasswordRecord pr) throws java.lang.Exception
pr
- the record.java.lang.Exception
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.