Package de.christofreichardt.jca.shamir
Class PasswordGenerator
- java.lang.Object
-
- de.christofreichardt.jca.shamir.PasswordGenerator
-
- All Implemented Interfaces:
de.christofreichardt.diagnosis.Traceable
public class PasswordGenerator extends Object implements de.christofreichardt.diagnosis.Traceable
Generates passwords with specified length and basic character set.- Author:
- Christof Reichardt
-
-
Constructor Summary
Constructors Constructor Description PasswordGenerator(int length)Creates a PasswordGenerator instance with the specified length and alphanumeric symbols as basic character set.PasswordGenerator(int length, char[] symbols)Creates a PasswordGenerator instance with the specified length and given basic character set.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static char[]all()static char[]alphanumeric()Defines the character set comprising alphanumeric symbols.static char[]alphanumericWithPunctuationAndSymbols()The union ofalphanumericandpunctuationAndSymbols()punctuationAndSymbol} characters.static char[]alphanumericWithUmlauts()The union ofalphanumericandumlautcharacters.Stream<CharSequence>generate()Generates a stream of passwords which will be built from the basic character set with the specified length.Stream<CharSequence>generate(char[] requiredChars)Generates a stream of passwords which will be built from the basic character set with the specified length.Stream<CharSequence>generate(Set<char[]> requiredCharSets)Generates a stream of passwords which will be built from the basic character set with the specified length.de.christofreichardt.diagnosis.AbstractTracergetCurrentTracer()Switched off.static char[]punctuationAndSymbols()Defines the character set comprising several punctuation marks and symbols.static char[]umlauts()Defines the character set comprising german umlauts.
-
-
-
Constructor Detail
-
PasswordGenerator
public PasswordGenerator(int length) throws GeneralSecurityExceptionCreates a PasswordGenerator instance with the specified length and alphanumeric symbols as basic character set.- Parameters:
length- the length of the generated passwords- Throws:
GeneralSecurityException- if no provider supports the requiredSecureRandominstance
-
PasswordGenerator
public PasswordGenerator(int length, char[] symbols) throws GeneralSecurityExceptionCreates a PasswordGenerator instance with the specified length and given basic character set.- Parameters:
length- the length of the generated passwordssymbols- the basic character set from which the passwords will be generated- Throws:
GeneralSecurityException- if no provider supports the requiredSecureRandominstance
-
-
Method Detail
-
alphanumeric
public static char[] alphanumeric()
Defines the character set comprising alphanumeric symbols.- Returns:
- all alphanumeric characters
-
umlauts
public static char[] umlauts()
Defines the character set comprising german umlauts.- Returns:
- all german umlauts
-
punctuationAndSymbols
public static char[] punctuationAndSymbols()
Defines the character set comprising several punctuation marks and symbols.- Returns:
- some punctuation marks and symbols
-
alphanumericWithUmlauts
public static char[] alphanumericWithUmlauts()
The union ofalphanumericandumlautcharacters.- Returns:
- all alphanumeric characters and all german umlauts
-
alphanumericWithPunctuationAndSymbols
public static char[] alphanumericWithPunctuationAndSymbols()
The union ofalphanumericandpunctuationAndSymbols()punctuationAndSymbol} characters.- Returns:
- all alphanumeric characters and some punctuation marks and symbols
-
all
public static char[] all()
- Returns:
- all of them
-
generate
public Stream<CharSequence> generate()
Generates a stream of passwords which will be built from the basic character set with the specified length.- Returns:
- a password stream
-
generate
public Stream<CharSequence> generate(char[] requiredChars)
Generates a stream of passwords which will be built from the basic character set with the specified length. All of the generated passwords will contain at least one of the required characters.- Parameters:
requiredChars- each generated password contains at least one of them- Returns:
- a password stream
-
generate
public Stream<CharSequence> generate(Set<char[]> requiredCharSets)
Generates a stream of passwords which will be built from the basic character set with the specified length. All of the generated passwords will contain at least one of the characters of each required character set.- Parameters:
requiredCharSets- each generated password contains at least one character of each required character set- Returns:
- a password stream
-
getCurrentTracer
public de.christofreichardt.diagnosis.AbstractTracer getCurrentTracer()
Switched off.- Specified by:
getCurrentTracerin interfacede.christofreichardt.diagnosis.Traceable- Returns:
- the NullTracer
-
-