Interface KeyGenerator.CharToByteConverter

All Known Implementing Classes:
PasswordConverter
Enclosing interface:
KeyGenerator

public static interface KeyGenerator.CharToByteConverter
An interface for converting a password of Java characters into an array of bytes. This conversion must be performed to provide a byte array to the low-level crypto engine. The default conversion is UTF8. Null-termination is not necessary, and indeed is usually incorrect, since the password is passed to the crypto engine as a byte array, not a C string.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    convert(char[] chars)
    Converts a password of Java characters into a password of bytes, using some encoding scheme.
  • Method Details

    • convert

      byte[] convert(char[] chars) throws CharConversionException
      Converts a password of Java characters into a password of bytes, using some encoding scheme. The input char array must not be modified.
      Parameters:
      chars - Password characters.
      Returns:
      Password as byte array.
      Throws:
      CharConversionException - If an error occurred.