; * lisp/net/tramp-crypt.el: Improve commentary

This commit is contained in:
Robert Pluim 2022-07-18 14:37:15 +02:00
parent cba30431ff
commit 62c47ffd5f

View file

@ -25,10 +25,10 @@
;; Access functions for encrypted remote files. It uses encfs to ;; Access functions for encrypted remote files. It uses encfs to
;; encrypt / decrypt the files on a remote directory. A remote ;; encrypt / decrypt the files on a remote directory. A remote
;; directory, which shall include encrypted files, must be declared in ;; directory where you wish files to be encrypted must be declared in
;; `tramp-crypt-directories' via command `tramp-crypt-add-directory'. ;; `tramp-crypt-directories' via command `tramp-crypt-add-directory'.
;; All files in that directory, including all subdirectories, are ;; All files in that directory, including all subdirectories, are
;; stored there encrypted. This includes file names and directory ;; stored encrypted. This includes file names and directory
;; names. ;; names.
;; This package is just responsible for the encryption part. Copying ;; This package is just responsible for the encryption part. Copying
@ -36,20 +36,21 @@
;; file name handlers. ;; file name handlers.
;; A password protected encfs configuration file is created the very ;; A password protected encfs configuration file is created the very
;; first time you access a encrypted remote directory. It is kept in ;; first time you access an encrypted remote directory. It is kept in
;; your user directory "~/.emacs.d/" with the url-encoded directory ;; your user directory (usually "~/.emacs.d/") with the url-encoded
;; name as part of the basename, and ".encfs6.xml" as suffix. Do not ;; directory name as part of the basename, and ".encfs6.xml" as
;; lose this file and the corresponding password; otherwise there is ;; suffix. Do not lose this file and the corresponding password;
;; no way to decrypt your encrypted files. ;; otherwise there is no way to decrypt your encrypted files.
;; If the user option `tramp-crypt-save-encfs-config-remote' is non-nil (the ;; If the user option `tramp-crypt-save-encfs-config-remote' is
;; default), the encfs configuration file ".encfs6.xml" is also kept ;; non-nil (the default), the encfs configuration file ".encfs6.xml"
;; in the encrypted remote directory. It depends on you, whether you ;; is also kept in the encrypted remote directory. It depends on you,
;; regard the password protection of this file as sufficient. ;; whether you regard the password protection of this file as
;; sufficient security.
;; If you use a remote file name with a quoted localname part, this ;; If you use a remote file name with a quoted localname part, this
;; localname and the corresponding file will not be encrypted/ ;; localname and the corresponding file will not be encrypted/
;; decrypted. For example, if you have a encrypted remote directory ;; decrypted. For example, if you have an encrypted remote directory
;; "/nextcloud:user@host:/encrypted_dir", the command ;; "/nextcloud:user@host:/encrypted_dir", the command
;; ;;
;; C-x d /nextcloud:user@host:/encrypted_dir ;; C-x d /nextcloud:user@host:/encrypted_dir
@ -61,11 +62,11 @@
;; ;;
;; will show the directory with the encrypted file names, and visiting ;; will show the directory with the encrypted file names, and visiting
;; a file will show its encrypted contents. However, it is highly ;; a file will show its encrypted contents. However, it is highly
;; discouraged to mix encrypted and not encrypted files in the same ;; discouraged to mix encrypted and non-encrypted files in the same
;; directory. ;; directory.
;; If a remote directory shall not include encrypted files anymore, it ;; To disable encryption for a particular remote directory, use the
;; must be indicated by the command `tramp-crypt-remove-directory'. ;; command `tramp-crypt-remove-directory'.
;;; Code: ;;; Code:
@ -142,7 +143,7 @@ They are completed by \"M-x TAB\" only when encryption support is enabled."
;;;###tramp-autoload ;;;###tramp-autoload
(defsubst tramp-crypt-file-name-p (name) (defsubst tramp-crypt-file-name-p (name)
"Return the encrypted remote directory NAME belongs to. "Return the encrypted remote directory NAME belongs to.
If NAME doesn't belong to a encrypted remote directory, retun nil." If NAME doesn't belong to an encrypted remote directory, retun nil."
(catch 'crypt-file-name-p (catch 'crypt-file-name-p
(and tramp-crypt-enabled (stringp name) (and tramp-crypt-enabled (stringp name)
(not (tramp-compat-file-name-quoted-p name)) (not (tramp-compat-file-name-quoted-p name))
@ -623,7 +624,7 @@ absolute file names."
(file-name-nondirectory encrypt-newname) tmpdir)) (file-name-nondirectory encrypt-newname) tmpdir))
tramp-crypt-enabled) tramp-crypt-enabled)
(cond (cond
;; Source and target file are on a encrypted remote directory. ;; Source and target file are on an encrypted remote directory.
((and t1 t2) ((and t1 t2)
(if (eq op 'copy) (if (eq op 'copy)
(copy-file (copy-file
@ -631,7 +632,7 @@ absolute file names."
keep-date preserve-uid-gid preserve-extended-attributes) keep-date preserve-uid-gid preserve-extended-attributes)
(rename-file (rename-file
encrypt-filename encrypt-newname ok-if-already-exists))) encrypt-filename encrypt-newname ok-if-already-exists)))
;; Source file is on a encrypted remote directory. ;; Source file is on an encrypted remote directory.
(t1 (t1
(if (eq op 'copy) (if (eq op 'copy)
(copy-file (copy-file
@ -640,7 +641,7 @@ absolute file names."
(rename-file encrypt-filename tmpfile1 t)) (rename-file encrypt-filename tmpfile1 t))
(tramp-crypt-decrypt-file t1 tmpfile1 tmpfile2) (tramp-crypt-decrypt-file t1 tmpfile1 tmpfile2)
(rename-file tmpfile2 newname ok-if-already-exists)) (rename-file tmpfile2 newname ok-if-already-exists))
;; Target file is on a encrypted remote directory. ;; Target file is on an encrypted remote directory.
(t2 (t2
(if (eq op 'copy) (if (eq op 'copy)
(copy-file (copy-file