diff options
| author | Ken Manheimer | 2010-11-26 16:34:17 -0500 |
|---|---|---|
| committer | Ken Manheimer | 2010-11-26 16:34:17 -0500 |
| commit | 7484c933aab704222d923b56ce134d2728ec2da9 (patch) | |
| tree | a73c470cde8db634147af948518fb65afa47bbbc | |
| parent | 4c168af24e4042a50b62cfdb9413b65ec9b79fca (diff) | |
| download | emacs-7484c933aab704222d923b56ce134d2728ec2da9.tar.gz emacs-7484c933aab704222d923b56ce134d2728ec2da9.zip | |
Elide passphrase caching provisions in preparation for migration from PGG
to EPA. Doing elisions with ";;PGG " so they can be found and removed when
i'm ready to finalize the transition.
(allout-toggle-current-subtree-encryption): Mark docstring references to
passphrase cache. (The marker is not effective as a comment within the
docstring, but they purpose is to be found and removed before release, so
tidiness is not necessary.)
Conform to changing allout-encrypt-string call signature.
(allout-encrypt-string): Remove fetch-pass argument from call signature.
Mark description for removal from docstring.
Require 'epa.
Establish not-yet-used epg-context with armoring.
Use epg-protocol as basis for the key description, instead of pgg-scheme or
pgg-default-scheme.
Elide all references to target-cache-id, and replace with value of for-key where
appropriate. Elide all uses of fetch-pass.
Elide all passphrase cache evictions.
(allout-obtain-passphrase): Remove passphrase-cache-related parameters -
cache-id and fetch-pass - from signature and from docstring.
Use for-key instead of cache-id in pgg-read-passphrase.
Elide all passphrase cache evictions.
Adjust for allout-encrypt-string call signature changes.
(allout-create-encryption-passphrase-verifier): Adjust for
allout-encrypt-string call signature changes.
(allout-verify-passphrase): Adjust for allout-encrypt-string call signature
changes.
| -rw-r--r-- | lisp/allout.el | 160 |
1 files changed, 91 insertions, 69 deletions
diff --git a/lisp/allout.el b/lisp/allout.el index fa940528b59..50c2bb194a1 100644 --- a/lisp/allout.el +++ b/lisp/allout.el | |||
| @@ -44,8 +44,8 @@ | |||
| 44 | ;; mnemonic support, with verification against an established passphrase | 44 | ;; mnemonic support, with verification against an established passphrase |
| 45 | ;; (using a stashed encrypted dummy string) and user-supplied hint | 45 | ;; (using a stashed encrypted dummy string) and user-supplied hint |
| 46 | ;; maintenance. (See allout-toggle-current-subtree-encryption docstring. | 46 | ;; maintenance. (See allout-toggle-current-subtree-encryption docstring. |
| 47 | ;; Currently only GnuPG encryption is supported, and integration | 47 | ;; Currently only GnuPG encryption is supported |
| 48 | ;; with gpg-agent is not yet implemented.) | 48 | ;;PGG and integration with gpg-agent is not yet implemented.) |
| 49 | ;; - Automatic topic-number maintenance | 49 | ;; - Automatic topic-number maintenance |
| 50 | ;; - "Hot-spot" operation, for single-keystroke maneuvering and | 50 | ;; - "Hot-spot" operation, for single-keystroke maneuvering and |
| 51 | ;; exposure control (see the allout-mode docstring) | 51 | ;; exposure control (see the allout-mode docstring) |
| @@ -6006,10 +6006,8 @@ it forces prompting for the passphrase regardless of availability from the | |||
| 6006 | passphrase cache. With no universal argument, the appropriate passphrase | 6006 | passphrase cache. With no universal argument, the appropriate passphrase |
| 6007 | is obtained from the cache, if available, else from the user. | 6007 | is obtained from the cache, if available, else from the user. |
| 6008 | 6008 | ||
| 6009 | Only GnuPG encryption is supported. | 6009 | Allout uses emacs 'epg' libary to perform encryption. Allout |
| 6010 | 6010 | encrypts with ascii armoring. | |
| 6011 | \*NOTE WELL* that the encrypted text must be ascii-armored. For gnupg | ||
| 6012 | encryption, include the option ``armor'' in your ~/.gnupg/gpg.conf file. | ||
| 6013 | 6011 | ||
| 6014 | Both symmetric-key and key-pair encryption is implemented. Symmetric is | 6012 | Both symmetric-key and key-pair encryption is implemented. Symmetric is |
| 6015 | the default, use a single (x4) universal argument for keypair mode. | 6013 | the default, use a single (x4) universal argument for keypair mode. |
| @@ -6035,8 +6033,8 @@ encrypted. If you want to encrypt the contents of a top-level topic, use | |||
| 6035 | The encryption passphrase is solicited if not currently available in the | 6033 | The encryption passphrase is solicited if not currently available in the |
| 6036 | passphrase cache from a recent encryption action. | 6034 | passphrase cache from a recent encryption action. |
| 6037 | 6035 | ||
| 6038 | The solicited passphrase is retained for reuse in a cache, if enabled. See | 6036 | ;;PGG The solicited passphrase is retained for reuse in a cache, if enabled. See |
| 6039 | `pgg-cache-passphrase' and `pgg-passphrase-cache-expiry' for details. | 6037 | ;;PGG `pgg-cache-passphrase' and `pgg-passphrase-cache-expiry' for details. |
| 6040 | 6038 | ||
| 6041 | Symmetric Passphrase Hinting and Verification | 6039 | Symmetric Passphrase Hinting and Verification |
| 6042 | 6040 | ||
| @@ -6079,8 +6077,7 @@ is obtained from the cache, if available, else from the user. | |||
| 6079 | Currently only GnuPG encryption is supported, and integration | 6077 | Currently only GnuPG encryption is supported, and integration |
| 6080 | with gpg-agent is not yet implemented. | 6078 | with gpg-agent is not yet implemented. |
| 6081 | 6079 | ||
| 6082 | \**NOTE WELL** that the encrypted text must be ascii-armored. For gnupg | 6080 | NOTE that the encrypted text will be ascii-armored. |
| 6083 | encryption, include the option ``armor'' in your ~/.gnupg/gpg.conf file. | ||
| 6084 | 6081 | ||
| 6085 | See `allout-toggle-current-subtree-encryption' for more details." | 6082 | See `allout-toggle-current-subtree-encryption' for more details." |
| 6086 | 6083 | ||
| @@ -6154,7 +6151,9 @@ See `allout-toggle-current-subtree-encryption' for more details." | |||
| 6154 | (setq result-text | 6151 | (setq result-text |
| 6155 | (allout-encrypt-string subject-text was-encrypted | 6152 | (allout-encrypt-string subject-text was-encrypted |
| 6156 | (current-buffer) | 6153 | (current-buffer) |
| 6157 | for-key-type for-key-identity fetch-pass)) | 6154 | for-key-type for-key-identity |
| 6155 | ;;PGG fetch-pass | ||
| 6156 | )) | ||
| 6158 | 6157 | ||
| 6159 | ;; Replace the subtree with the processed product. | 6158 | ;; Replace the subtree with the processed product. |
| 6160 | (allout-unprotected | 6159 | (allout-unprotected |
| @@ -6186,23 +6185,25 @@ See `allout-toggle-current-subtree-encryption' for more details." | |||
| 6186 | (run-hook-with-args 'allout-structure-added-hook | 6185 | (run-hook-with-args 'allout-structure-added-hook |
| 6187 | bullet-pos subtree-end)))) | 6186 | bullet-pos subtree-end)))) |
| 6188 | ;;;_ > allout-encrypt-string (text decrypt allout-buffer key-type for-key | 6187 | ;;;_ > allout-encrypt-string (text decrypt allout-buffer key-type for-key |
| 6189 | ;;; fetch-pass &optional retried verifying | 6188 | ;;; ;;PGG fetch-pass |
| 6189 | ;;; &optional retried verifying | ||
| 6190 | ;;; passphrase) | 6190 | ;;; passphrase) |
| 6191 | (defun allout-encrypt-string (text decrypt allout-buffer key-type for-key | 6191 | (defun allout-encrypt-string (text decrypt allout-buffer key-type for-key |
| 6192 | fetch-pass &optional retried rejected | 6192 | ;;PGG fetch-pass |
| 6193 | &optional retried rejected | ||
| 6193 | verifying passphrase) | 6194 | verifying passphrase) |
| 6194 | "Encrypt or decrypt message TEXT. | 6195 | "Encrypt or decrypt message TEXT. |
| 6195 | 6196 | ||
| 6196 | If DECRYPT is true (default false), then decrypt instead of encrypt. | 6197 | If DECRYPT is true (default false), then decrypt instead of encrypt. |
| 6197 | 6198 | ||
| 6198 | FETCH-PASS (default false) forces fresh prompting for the passphrase. | ||
| 6199 | |||
| 6200 | KEY-TYPE, either `symmetric' or `keypair', specifies which type | 6199 | KEY-TYPE, either `symmetric' or `keypair', specifies which type |
| 6201 | of cypher to use. | 6200 | of cypher to use. |
| 6202 | 6201 | ||
| 6203 | FOR-KEY is human readable identification of the first of the user's | 6202 | FOR-KEY is human readable identification of the first of the user's |
| 6204 | eligible secret keys a keypair decryption targets, or else nil. | 6203 | eligible secret keys a keypair decryption targets, or else nil. |
| 6205 | 6204 | ||
| 6205 | ;;PGG FETCH-PASS (default false) forces fresh prompting for the passphrase. | ||
| 6206 | |||
| 6206 | Optional RETRIED is for internal use -- conveys the number of failed keys | 6207 | Optional RETRIED is for internal use -- conveys the number of failed keys |
| 6207 | that have been solicited in sequence leading to this current call. | 6208 | that have been solicited in sequence leading to this current call. |
| 6208 | 6209 | ||
| @@ -6216,26 +6217,28 @@ rejections due to matches against | |||
| 6216 | 6217 | ||
| 6217 | Returns the resulting string, or nil if the transformation fails." | 6218 | Returns the resulting string, or nil if the transformation fails." |
| 6218 | 6219 | ||
| 6220 | (require 'epa) | ||
| 6219 | (require 'pgg) | 6221 | (require 'pgg) |
| 6220 | 6222 | ||
| 6221 | (let* ((scheme (upcase | 6223 | (let* ((epg-context (epg-make-context epa-protocol t)) |
| 6222 | (format "%s" (or pgg-scheme pgg-default-scheme "GPG")))) | 6224 | ;;PGG (scheme (upcase |
| 6225 | ;;PGG (format "%s" (or pgg-scheme pgg-default-scheme "GPG")))) | ||
| 6223 | (for-key (and (equal key-type 'keypair) | 6226 | (for-key (and (equal key-type 'keypair) |
| 6224 | (or for-key | 6227 | (or for-key |
| 6225 | (split-string (read-string | 6228 | (split-string (read-string |
| 6226 | (format "%s message recipients: " | 6229 | (format "%s message recipients: " |
| 6227 | scheme)) | 6230 | epa-protocol)) |
| 6228 | "[ \t,]+")))) | 6231 | "[ \t,]+")))) |
| 6229 | (target-prompt-id (if (equal key-type 'keypair) | 6232 | (target-prompt-id (if (equal key-type 'keypair) |
| 6230 | (if (= (length for-key) 1) | 6233 | (if (= (length for-key) 1) |
| 6231 | (car for-key) for-key) | 6234 | (car for-key) for-key) |
| 6232 | (buffer-name allout-buffer))) | 6235 | (buffer-name allout-buffer))) |
| 6233 | (target-cache-id (format "%s-%s" | 6236 | ;;PGG (target-cache-id (format "%s-%s" |
| 6234 | key-type | 6237 | ;;PGG key-type |
| 6235 | (if (equal key-type 'keypair) | 6238 | ;;PGG (if (equal key-type 'keypair) |
| 6236 | target-prompt-id | 6239 | ;;PGG target-prompt-id |
| 6237 | (or (buffer-file-name allout-buffer) | 6240 | ;;PGG (or (buffer-file-name allout-buffer) |
| 6238 | target-prompt-id)))) | 6241 | ;;PGG target-prompt-id)))) |
| 6239 | (encoding (with-current-buffer allout-buffer | 6242 | (encoding (with-current-buffer allout-buffer |
| 6240 | buffer-file-coding-system)) | 6243 | buffer-file-coding-system)) |
| 6241 | (multibyte (with-current-buffer allout-buffer | 6244 | (multibyte (with-current-buffer allout-buffer |
| @@ -6254,9 +6257,9 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6254 | result-text status | 6257 | result-text status |
| 6255 | ) | 6258 | ) |
| 6256 | 6259 | ||
| 6257 | (if (and fetch-pass (not passphrase)) | 6260 | ;;PGG (if (and fetch-pass (not passphrase)) |
| 6258 | ;; Force later fetch by evicting passphrase from the cache. | 6261 | ;;PGG ;; Force later fetch by evicting passphrase from the cache. |
| 6259 | (pgg-remove-passphrase-from-cache target-cache-id t)) | 6262 | ;;PGG (pgg-remove-passphrase-from-cache target-cache-id t)) |
| 6260 | 6263 | ||
| 6261 | (catch 'encryption-failed | 6264 | (catch 'encryption-failed |
| 6262 | 6265 | ||
| @@ -6264,11 +6267,13 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6264 | (if (and (not passphrase) | 6267 | (if (and (not passphrase) |
| 6265 | (not (equal key-type 'keypair))) | 6268 | (not (equal key-type 'keypair))) |
| 6266 | (setq passphrase (allout-obtain-passphrase for-key | 6269 | (setq passphrase (allout-obtain-passphrase for-key |
| 6267 | target-cache-id | 6270 | ;;PGG target-cache-id |
| 6268 | target-prompt-id | 6271 | target-prompt-id |
| 6269 | key-type | 6272 | key-type |
| 6270 | allout-buffer | 6273 | allout-buffer |
| 6271 | retried fetch-pass))) | 6274 | retried |
| 6275 | ;;PGG fetch-pass | ||
| 6276 | ))) | ||
| 6272 | 6277 | ||
| 6273 | (with-temp-buffer | 6278 | (with-temp-buffer |
| 6274 | 6279 | ||
| @@ -6307,7 +6312,7 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6307 | ;; failed -- handle passphrase caching | 6312 | ;; failed -- handle passphrase caching |
| 6308 | (if verifying | 6313 | (if verifying |
| 6309 | (throw 'encryption-failed nil) | 6314 | (throw 'encryption-failed nil) |
| 6310 | (pgg-remove-passphrase-from-cache target-cache-id t) | 6315 | ;;PGG (pgg-remove-passphrase-from-cache target-cache-id t) |
| 6311 | (error "Symmetric-cipher %scryption failed -- %s" | 6316 | (error "Symmetric-cipher %scryption failed -- %s" |
| 6312 | (if decrypt "de" "en") | 6317 | (if decrypt "de" "en") |
| 6313 | "try again with different passphrase")))) | 6318 | "try again with different passphrase")))) |
| @@ -6322,7 +6327,7 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6322 | 6327 | ||
| 6323 | (if status | 6328 | (if status |
| 6324 | (pgg-situate-output (point-min) (point-max)) | 6329 | (pgg-situate-output (point-min) (point-max)) |
| 6325 | (error (pgg-remove-passphrase-from-cache target-cache-id t) | 6330 | (error ;;PGG (pgg-remove-passphrase-from-cache target-cache-id t) |
| 6326 | (error "encryption failed")))) | 6331 | (error "encryption failed")))) |
| 6327 | 6332 | ||
| 6328 | ;; decrypt `keypair': | 6333 | ;; decrypt `keypair': |
| @@ -6333,7 +6338,7 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6333 | 6338 | ||
| 6334 | (if status | 6339 | (if status |
| 6335 | (pgg-situate-output (point-min) (point-max)) | 6340 | (pgg-situate-output (point-min) (point-max)) |
| 6336 | (error (pgg-remove-passphrase-from-cache target-cache-id t) | 6341 | (error ;;PGG (pgg-remove-passphrase-from-cache target-cache-id t) |
| 6337 | (error "decryption failed"))))) | 6342 | (error "decryption failed"))))) |
| 6338 | 6343 | ||
| 6339 | (setq result-text | 6344 | (setq result-text |
| @@ -6346,9 +6351,10 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6346 | (if verifying | 6351 | (if verifying |
| 6347 | nil | 6352 | nil |
| 6348 | ;; transform was fruitless, retry w/new passphrase. | 6353 | ;; transform was fruitless, retry w/new passphrase. |
| 6349 | (pgg-remove-passphrase-from-cache target-cache-id t) | 6354 | ;;PGG (pgg-remove-passphrase-from-cache target-cache-id t) |
| 6350 | (allout-encrypt-string text decrypt allout-buffer | 6355 | (allout-encrypt-string text decrypt allout-buffer |
| 6351 | key-type for-key nil | 6356 | key-type for-key |
| 6357 | ;;PGG nil | ||
| 6352 | (if retried (1+ retried) 1) | 6358 | (if retried (1+ retried) 1) |
| 6353 | rejected verifying nil))) | 6359 | rejected verifying nil))) |
| 6354 | 6360 | ||
| @@ -6369,7 +6375,8 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6369 | allout-encryption-ciphertext-rejection-ceiling | 6375 | allout-encryption-ciphertext-rejection-ceiling |
| 6370 | 'allout-encryption-ciphertext-rejection-regexps) | 6376 | 'allout-encryption-ciphertext-rejection-regexps) |
| 6371 | (allout-encrypt-string text decrypt allout-buffer | 6377 | (allout-encrypt-string text decrypt allout-buffer |
| 6372 | key-type for-key nil | 6378 | key-type for-key |
| 6379 | ;;PGG nil | ||
| 6373 | retried (1+ rejected) | 6380 | retried (1+ rejected) |
| 6374 | verifying passphrase))) | 6381 | verifying passphrase))) |
| 6375 | ;; Barf if encryption yields extraordinary control chars: | 6382 | ;; Barf if encryption yields extraordinary control chars: |
| @@ -6381,18 +6388,18 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6381 | 6388 | ||
| 6382 | ;; valid result and just verifying or non-symmetric: | 6389 | ;; valid result and just verifying or non-symmetric: |
| 6383 | ((or verifying (not (equal key-type 'symmetric))) | 6390 | ((or verifying (not (equal key-type 'symmetric))) |
| 6384 | (if (or verifying decrypt) | 6391 | ;;PGG (if (or verifying decrypt) |
| 6385 | (pgg-add-passphrase-to-cache target-cache-id | 6392 | ;;PGG (pgg-add-passphrase-to-cache target-cache-id |
| 6386 | passphrase t)) | 6393 | ;;PGG passphrase t)) |
| 6387 | result-text) | 6394 | result-text) |
| 6388 | 6395 | ||
| 6389 | ;; valid result and regular symmetric -- "register" | 6396 | ;; valid result and regular symmetric -- "register" |
| 6390 | ;; passphrase with mnemonic aids/cache. | 6397 | ;; passphrase with mnemonic aids/cache. |
| 6391 | (t | 6398 | (t |
| 6392 | (set-buffer allout-buffer) | 6399 | (set-buffer allout-buffer) |
| 6393 | (if passphrase | 6400 | ;;PGG (if passphrase |
| 6394 | (pgg-add-passphrase-to-cache target-cache-id | 6401 | ;;PGG (pgg-add-passphrase-to-cache target-cache-id |
| 6395 | passphrase t)) | 6402 | ;;PGG passphrase t)) |
| 6396 | (allout-update-passphrase-mnemonic-aids for-key passphrase | 6403 | (allout-update-passphrase-mnemonic-aids for-key passphrase |
| 6397 | allout-buffer) | 6404 | allout-buffer) |
| 6398 | result-text) | 6405 | result-text) |
| @@ -6400,11 +6407,14 @@ Returns the resulting string, or nil if the transformation fails." | |||
| 6400 | ) | 6407 | ) |
| 6401 | ) | 6408 | ) |
| 6402 | ) | 6409 | ) |
| 6403 | ;;;_ > allout-obtain-passphrase (for-key cache-id prompt-id key-type | 6410 | ;;;_ > allout-obtain-passphrase (for-key ;;PGG cache-id |
| 6404 | ;;; allout-buffer retried fetch-pass) | 6411 | ;;; prompt-id key-type allout-buffer retried |
| 6405 | (defun allout-obtain-passphrase (for-key cache-id prompt-id key-type | 6412 | ;;; ;;PGG fetch-pass) |
| 6406 | allout-buffer retried fetch-pass) | 6413 | (defun allout-obtain-passphrase (for-key ;;PGG cache-id |
| 6407 | "Obtain passphrase for a key from the cache or else from the user. | 6414 | prompt-id key-type allout-buffer retried |
| 6415 | ;;fetch-pass | ||
| 6416 | ) | ||
| 6417 | "Obtain passphrase for a key from the user. | ||
| 6408 | 6418 | ||
| 6409 | When obtaining from the user, symmetric-cipher passphrases are verified | 6419 | When obtaining from the user, symmetric-cipher passphrases are verified |
| 6410 | against either, if available and enabled, a random string that was | 6420 | against either, if available and enabled, a random string that was |
| @@ -6413,7 +6423,7 @@ user for corroboration. | |||
| 6413 | 6423 | ||
| 6414 | FOR-KEY is the key for which the passphrase is being obtained. | 6424 | FOR-KEY is the key for which the passphrase is being obtained. |
| 6415 | 6425 | ||
| 6416 | CACHE-ID is the cache id of the key for the passphrase. | 6426 | ;;PGG CACHE-ID is the cache id of the key for the passphrase. |
| 6417 | 6427 | ||
| 6418 | PROMPT-ID is the id for use when prompting the user. | 6428 | PROMPT-ID is the id for use when prompting the user. |
| 6419 | 6429 | ||
| @@ -6423,8 +6433,9 @@ ALLOUT-BUFFER is the buffer containing the entry being en/decrypted. | |||
| 6423 | 6433 | ||
| 6424 | RETRIED is the number of this attempt to obtain this passphrase. | 6434 | RETRIED is the number of this attempt to obtain this passphrase. |
| 6425 | 6435 | ||
| 6426 | FETCH-PASS causes the passphrase to be solicited from the user, regardless | 6436 | ;;PGG FETCH-PASS causes the passphrase to be solicited from the user, regardless |
| 6427 | of the availability of a cached copy." | 6437 | ;;PGG of the availability of a cached copy. |
| 6438 | " | ||
| 6428 | 6439 | ||
| 6429 | (if (not (equal key-type 'symmetric)) | 6440 | (if (not (equal key-type 'symmetric)) |
| 6430 | ;; do regular passphrase read on non-symmetric passphrase: | 6441 | ;; do regular passphrase read on non-symmetric passphrase: |
| @@ -6435,7 +6446,8 @@ of the availability of a cached copy." | |||
| 6435 | (if prompt-id | 6446 | (if prompt-id |
| 6436 | (format " for %s" prompt-id) | 6447 | (format " for %s" prompt-id) |
| 6437 | "")) | 6448 | "")) |
| 6438 | cache-id t) | 6449 | for-key ;;PGG cache-id |
| 6450 | t) | ||
| 6439 | 6451 | ||
| 6440 | ;; Symmetric hereon: | 6452 | ;; Symmetric hereon: |
| 6441 | 6453 | ||
| @@ -6455,10 +6467,12 @@ of the availability of a cached copy." | |||
| 6455 | (prompt full-prompt) | 6467 | (prompt full-prompt) |
| 6456 | (verifier-string (allout-get-encryption-passphrase-verifier)) | 6468 | (verifier-string (allout-get-encryption-passphrase-verifier)) |
| 6457 | 6469 | ||
| 6458 | (cached (and (not fetch-pass) | 6470 | ;;PGG (cached (and (not fetch-pass) |
| 6459 | (pgg-read-passphrase-from-cache cache-id t))) | 6471 | ;;PGG (pgg-read-passphrase-from-cache cache-id t))) |
| 6460 | (got-pass (or cached | 6472 | (got-pass ;;PGG (or cached |
| 6461 | (pgg-read-passphrase full-prompt cache-id t))) | 6473 | (pgg-read-passphrase full-prompt ;;PGG cache-id |
| 6474 | for-key t)) | ||
| 6475 | ;;PGG ) | ||
| 6462 | confirmation) | 6476 | confirmation) |
| 6463 | 6477 | ||
| 6464 | (if (not got-pass) | 6478 | (if (not got-pass) |
| @@ -6471,8 +6485,9 @@ of the availability of a cached copy." | |||
| 6471 | (cond (verifier-string | 6485 | (cond (verifier-string |
| 6472 | (save-window-excursion | 6486 | (save-window-excursion |
| 6473 | (if (allout-encrypt-string verifier-string 'decrypt | 6487 | (if (allout-encrypt-string verifier-string 'decrypt |
| 6474 | allout-buffer 'symmetric | 6488 | allout-buffer 'symmetric for-key |
| 6475 | for-key nil 0 0 'verifying | 6489 | ;;PGG nil |
| 6490 | 0 0 'verifying | ||
| 6476 | (copy-sequence got-pass)) | 6491 | (copy-sequence got-pass)) |
| 6477 | (setq confirmation (format "%s" got-pass)))) | 6492 | (setq confirmation (format "%s" got-pass)))) |
| 6478 | 6493 | ||
| @@ -6483,33 +6498,38 @@ of the availability of a cached copy." | |||
| 6483 | ;; deactivate password for subsequent | 6498 | ;; deactivate password for subsequent |
| 6484 | ;; confirmation: | 6499 | ;; confirmation: |
| 6485 | (progn | 6500 | (progn |
| 6486 | (pgg-remove-passphrase-from-cache cache-id t) | 6501 | ;;PGG (pgg-remove-passphrase-from-cache cache-id t) |
| 6487 | (setq prompt prompt-sans-hint) | 6502 | (setq prompt prompt-sans-hint) |
| 6488 | nil) | 6503 | nil) |
| 6489 | t)) | 6504 | t)) |
| 6490 | (progn (pgg-remove-passphrase-from-cache cache-id t) | 6505 | ;;PGG (progn (pgg-remove-passphrase-from-cache cache-id t) |
| 6491 | (error "Wrong passphrase")))) | 6506 | (error "Wrong passphrase"))) |
| 6507 | ;;PGG) | ||
| 6492 | ;; No verifier string -- force confirmation by repetition of | 6508 | ;; No verifier string -- force confirmation by repetition of |
| 6493 | ;; (new) passphrase: | 6509 | ;; (new) passphrase: |
| 6494 | ((or fetch-pass (not cached)) | 6510 | ;;PGG ((or fetch-pass (not cached)) |
| 6495 | (pgg-remove-passphrase-from-cache cache-id t)))) | 6511 | ;;PGG (pgg-remove-passphrase-from-cache cache-id t))) |
| 6512 | ) | ||
| 6496 | ;; confirmation vs new input -- doing pgg-read-passphrase will do the | 6513 | ;; confirmation vs new input -- doing pgg-read-passphrase will do the |
| 6497 | ;; right thing, in either case: | 6514 | ;; right thing, in either case: |
| 6498 | (if (not confirmation) | 6515 | (if (not confirmation) |
| 6499 | (setq confirmation | 6516 | (setq confirmation |
| 6500 | (pgg-read-passphrase (concat prompt | 6517 | (pgg-read-passphrase (concat prompt |
| 6501 | " ... confirm spelling: ") | 6518 | " ... confirm spelling: ") |
| 6502 | cache-id t))) | 6519 | ;;PGG cache-id |
| 6520 | for-key t))) | ||
| 6503 | (prog1 | 6521 | (prog1 |
| 6504 | (if (equal got-pass confirmation) | 6522 | (if (equal got-pass confirmation) |
| 6505 | confirmation | 6523 | confirmation |
| 6506 | (if (yes-or-no-p (concat "spelling of original and" | 6524 | (if (yes-or-no-p (concat "spelling of original and" |
| 6507 | " confirmation differ -- retry? ")) | 6525 | " confirmation differ -- retry? ")) |
| 6508 | (progn (setq retried (if retried (1+ retried) 1)) | 6526 | (progn (setq retried (if retried (1+ retried) 1)) |
| 6509 | (pgg-remove-passphrase-from-cache cache-id t) | 6527 | ;;PGG (pgg-remove-passphrase-from-cache cache-id |
| 6528 | for-key t) | ||
| 6510 | ;; recurse to this routine: | 6529 | ;; recurse to this routine: |
| 6511 | (pgg-read-passphrase prompt-sans-hint cache-id t)) | 6530 | (pgg-read-passphrase prompt-sans-hint ;;PGG cache-id |
| 6512 | (pgg-remove-passphrase-from-cache cache-id t) | 6531 | for-key t)) |
| 6532 | ;;PGG (pgg-remove-passphrase-from-cache cache-id t) | ||
| 6513 | (error "Confirmation failed")))))))) | 6533 | (error "Confirmation failed")))))))) |
| 6514 | ;;;_ > allout-encrypted-topic-p () | 6534 | ;;;_ > allout-encrypted-topic-p () |
| 6515 | (defun allout-encrypted-topic-p () | 6535 | (defun allout-encrypted-topic-p () |
| @@ -6562,8 +6582,9 @@ An error is raised if the text is not encrypted." | |||
| 6562 | (let ((spew (make-string 20 ?\0))) | 6582 | (let ((spew (make-string 20 ?\0))) |
| 6563 | (dotimes (i (length spew)) | 6583 | (dotimes (i (length spew)) |
| 6564 | (aset spew i (1+ (random 254)))) | 6584 | (aset spew i (1+ (random 254)))) |
| 6565 | (allout-encrypt-string spew nil (current-buffer) 'symmetric | 6585 | (allout-encrypt-string spew nil (current-buffer) 'symmetric nil |
| 6566 | nil nil 0 0 passphrase)) | 6586 | ;;PGG nil |
| 6587 | nil 0 0 passphrase)) | ||
| 6567 | ) | 6588 | ) |
| 6568 | ;;;_ > allout-update-passphrase-mnemonic-aids (for-key passphrase | 6589 | ;;;_ > allout-update-passphrase-mnemonic-aids (for-key passphrase |
| 6569 | ;;; outline-buffer) | 6590 | ;;; outline-buffer) |
| @@ -6640,8 +6661,9 @@ Derived from value of `allout-passphrase-verifier-string'." | |||
| 6640 | (and (boundp 'allout-passphrase-verifier-string) | 6661 | (and (boundp 'allout-passphrase-verifier-string) |
| 6641 | allout-passphrase-verifier-string | 6662 | allout-passphrase-verifier-string |
| 6642 | (allout-encrypt-string (allout-get-encryption-passphrase-verifier) | 6663 | (allout-encrypt-string (allout-get-encryption-passphrase-verifier) |
| 6643 | 'decrypt allout-buffer 'symmetric | 6664 | 'decrypt allout-buffer 'symmetric key |
| 6644 | key nil 0 0 'verifying passphrase) | 6665 | ;;PGG nil |
| 6666 | 0 0 'verifying passphrase) | ||
| 6645 | t))) | 6667 | t))) |
| 6646 | ;;;_ > allout-next-topic-pending-encryption (&optional except-mark) | 6668 | ;;;_ > allout-next-topic-pending-encryption (&optional except-mark) |
| 6647 | (defun allout-next-topic-pending-encryption (&optional except-mark) | 6669 | (defun allout-next-topic-pending-encryption (&optional except-mark) |