Class KeyUtils


  • @Deprecated
    public class KeyUtils
    extends Object
    Deprecated.
    Consider to use SecretBytes instead.
    Utility methods for handling key files.
    • Method Detail

      • createKeyFile

        public static File createKeyFile​(String prefix,
                                         String suffix)
                                  throws IOException
        Deprecated.
        Creates a file with the given prefix/suffix in a standard Google auth directory, and sets the permissions of the file to owner-only read/write. Note: this doesn't work on Windows.
        Throws:
        IOException - if filesystem interaction fails.
      • updatePermissions

        public static void updatePermissions​(File file)
                                      throws IOException
        Deprecated.
        Sets the permissions of the file to owner-only read/write. Note: this doesn't work on Windows.
        Throws:
        IOException - if filesystem interaction fails.
      • writeKeyToFileEncoded

        public static void writeKeyToFileEncoded​(String key,
                                                 File file)
                                          throws IOException
        Deprecated.
        Writes the given key to the given keyfile, passing it through Secret to encode the string. Note that, per the documentation of Secret, this does not protect against an attacker who has full access to the local file system, but reduces the chance of accidental exposure.
        Throws:
        IOException
      • writeKeyToFile

        public static void writeKeyToFile​(InputStream keyStream,
                                          File file)
                                   throws IOException
        Deprecated.
        Writes the key contained in the given InputStream to the given keyfile. Does not close the input stream.
        Throws:
        IOException