Class Password

java.lang.Object
zeroecho.sdk.util.Password

public final class Password extends Object
Utility class for generating random passwords and secure random byte arrays.

This class provides methods to:

  • Generate cryptographically secure random byte arrays of specified length.
  • Generate random passwords composed of characters derived from random bytes.

Randomness is supplied by the shared thread-safe source in RandomSupport.

Since:
1.0
  • Method Details

    • generateRandom

      public static byte[] generateRandom(byte[] password)
      Fills the supplied array with cryptographically strong random bytes.
      Parameters:
      password - array to fill; must not be null
      Returns:
      password
      Throws:
      NullPointerException - if password is null
    • generatePrintablePasswordChars

      public static char[] generatePrintablePasswordChars(int length)
      Generates a printable password in a caller-owned character array.
      Parameters:
      length - desired password length; must be positive
      Returns:
      a newly allocated printable password
      Throws:
      IllegalArgumentException - if length is not positive