(defgroup netrc nil
"Netrc configuration.")
-(defcustom netrc-encoding-method nil
+(defcustom netrc-encrypting-method nil
"Decoding method used for the netrc file.
Use the OpenSSL symmetric ciphers here. Leave nil for no
-decoding. Encode the file with netrc-encode, but make sure you
-have set netrc-encoding-method to a non-nil value."
+decoding. Encrypt the file with netrc-encrypt, but make sure you
+have set netrc-encrypting-method to a non-nil value."
:type '(choice
(const :tag "DES-3" "des3")
(const :tag "IDEA" "idea")
(const :tag "openssl is not installed" nil))
:group 'netrc)
-(defun netrc-encode (plain-file encoded-file)
- (interactive "fPlain File: \nFEncoded File: ")
- "Encode FILE to ENCODED-FILE with netrc-encoding-method cipher."
+(defun netrc-encrypt (plain-file encrypted-file)
+ (interactive "fPlain File: \nFEncrypted File: ")
+ "Encrypt FILE to ENCRYPTED-FILE with netrc-encrypting-method cipher."
(when (and (file-exists-p plain-file)
- (stringp encoded-file)
- netrc-encoding-method
+ (stringp encrypted-file)
+ netrc-encrypting-method
netrc-openssl-path)
(let ((buffer-file-coding-system 'binary)
(coding-system-for-read 'binary)
(password
(password-read
(format "OpenSSL Password for cipher %s? "
- netrc-encoding-method)
+ netrc-encrypting-method)
(format "netrc-openssl-password-%s"
- netrc-encoding-method))))
+ netrc-encrypting-method))))
(when password
(with-temp-buffer
(insert-file-contents plain-file)
(point-max)
(format "%s %s -pass env:NETRC_OPENSSL_PASSWORD -e"
netrc-openssl-path
- netrc-encoding-method)
+ netrc-encrypting-method)
t
t)
- (write-file encoded-file t))))))
+ (write-file encrypted-file t))))))
(defun netrc-parse (file)
(interactive "fFile to Parse: ")
"password" "account" "macdef" "force"
"port"))
alist elem result pair)
- (if (and netrc-encoding-method
+ (if (and netrc-encrypting-method
netrc-openssl-path)
(let ((buffer-file-coding-system 'binary)
(coding-system-for-read 'binary)
(password
(password-read
(format "OpenSSL Password for cipher %s? "
- netrc-encoding-method)
+ netrc-encrypting-method)
(format "netrc-openssl-password-%s"
- netrc-encoding-method))))
+ netrc-encrypting-method))))
(when password
(insert-file-contents file)
(setenv "NETRC_OPENSSL_PASSWORD" password)
(point-max)
(format "%s %s -pass env:NETRC_OPENSSL_PASSWORD -d"
netrc-openssl-path
- netrc-encoding-method)
+ netrc-encrypting-method)
t
t)))
(insert-file-contents file))