You want to use the same command for encryption and compression. You want to avoid installing other packages. What should you do?
Use zip. The tar command by itself does NOT do compression (according to this external posting).
One advantage of zip is that it is usually pre-installed on most Linux servers. The user and group of the files thus compressed will be retained automatically.
Draft a zip command like the one below. Replace "goodfile" with the file you want to be copied into a compressed and encrypted copy. Replace "good.zip" with the name of the new compressed & encrypted file you want the command to create.
zip --encrypt good.zip goodfile # This command will prompt you for a password. Remember the password.
# Run the command after it is drafted according to the directions above.
You can move a copy to a different directory, then run this command to extract a regular version of this file that was encrypted and compressed in good.zip:
unzip good.zip # Where "good.zip" is the name of the .zip file.
If you only need to compress, see this external page for examples of different tools.