Mercurial > emacs
annotate lisp/net/sasl-cram.el @ 94340:00e54fde074a font-backend-base
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Thu, 24 Apr 2008 22:38:12 +0000 |
parents | 1e3a407766b9 |
children | 91e5880a36c1 |
rev | line source |
---|---|
86994 | 1 ;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework |
2 | |
87665 | 3 ;; Copyright (C) 2000, 2007, 2008 Free Software Foundation, Inc. |
86994 | 4 |
5 ;; Author: Daiki Ueno <ueno@unixuser.org> | |
6 ;; Kenichi OKADA <okada@opaopa.org> | |
7 ;; Keywords: SASL, CRAM-MD5 | |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 3, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
24 ;; Boston, MA 02110-1301, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 (require 'sasl) | |
29 (require 'hmac-md5) | |
30 | |
31 (defconst sasl-cram-md5-steps | |
32 '(ignore ;no initial response | |
33 sasl-cram-md5-response)) | |
34 | |
35 (defun sasl-cram-md5-response (client step) | |
36 (let ((passphrase | |
37 (sasl-read-passphrase | |
38 (format "CRAM-MD5 passphrase for %s: " | |
39 (sasl-client-name client))))) | |
40 (unwind-protect | |
41 (concat (sasl-client-name client) " " | |
42 (encode-hex-string | |
43 (hmac-md5 (sasl-step-data step) passphrase))) | |
44 (fillarray passphrase 0)))) | |
45 | |
46 (put 'sasl-cram 'sasl-mechanism | |
47 (sasl-make-mechanism "CRAM-MD5" sasl-cram-md5-steps)) | |
48 | |
49 (provide 'sasl-cram) | |
50 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87665
diff
changeset
|
51 ;; arch-tag: 46cb281b-975a-4fe0-a39f-3018691b1b05 |
86994 | 52 ;;; sasl-cram.el ends here |