;; -*- Emacs-lisp -*-

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Gnus
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

;; set up the sources of where I receive mail
(setq gnus-select-method '(nnimap "localhost" (nnimap-address "localhost")))
(setq gnus-outgoing-message-group "INBOX.Sent")
(setq nnimap-authinfo-file (concat (getenv "HOME") "/etc/auth/gnus"))

(setq smtpmail-smtp-server "localhost")
(setq smtpmail-smtp-service 25)
(setq smtpmail-starttls-credentials nil)
(setq smtpmail-auth-credentials nil)

;; By default, sign everything
(add-hook 'gnus-message-setup-hook 'mml-secure-message-sign-pgpmime)

(if (require 'epa)
    (progn
      (setq epa-pinentry-mode 'loopback)
      (if (functionp 'pinentry-start)
          (pinentry-start))))

(defun eaw-c4z-dec ()
  (interactive)
  (shell-command-on-region
   (point-min) (point-max)
   (concat "openssl smime -decrypt -inkey " (getenv "HOME") "/etc/c4/privatekey.pem -inform der")
   t t))

(defun eaw-c4i-dec ()
  (interactive)
  (shell-command-on-region
   (point) (mark)
   (concat "openssl aes-256-ctr -d -a -iv 00000000000000000000000000000001 -K 7db208c0699b14b46ef81b97f39afc9868dd158f1636f7f43866dfe55f19f498")
   t t))

(provide 'ew-local)