cipher-algorithm digest-algorithm compress-algorithm
#'epg-passphrase-callback-function
nil
- nil nil nil nil nil)))
+ nil nil nil nil nil nil)))
(defun epg-context-protocol (context)
"Return the protocol used within CONTEXT."
(signal 'wrong-type-argument (list 'epg-context-p context)))
(aref (cdr context) 9))
+(defun epg-context-sig-notations (context)
+ "Return the list of notations for singning."
+ (unless (eq (car-safe context) 'epg-context)
+ (signal 'wrong-type-argument (list 'epg-context-p context)))
+ (aref (cdr context) 10))
+
(defun epg-context-process (context)
"Return the process object of `epg-gpg-program'.
This function is for internal use only."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aref (cdr context) 10))
+ (aref (cdr context) 11))
(defun epg-context-output-file (context)
"Return the output file of `epg-gpg-program'.
This function is for internal use only."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aref (cdr context) 11))
+ (aref (cdr context) 12))
(defun epg-context-result (context)
"Return the result of the previous cryptographic operation."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aref (cdr context) 12))
+ (aref (cdr context) 13))
(defun epg-context-operation (context)
"Return the name of the current cryptographic operation."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aref (cdr context) 13))
+ (aref (cdr context) 14))
(defun epg-context-set-protocol (context protocol)
"Set the protocol used within CONTEXT."
(aset (cdr context) 8 progress-callback))
(defun epg-context-set-signers (context signers)
- "Set the list of key-id for singning."
+ "Set the list of key-id for singning."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
(aset (cdr context) 9 signers))
+(defun epg-context-set-sig-notations (context notations)
+ "Set the list of notations for singning."
+ (unless (eq (car-safe context) 'epg-context)
+ (signal 'wrong-type-argument (list 'epg-context-p context)))
+ (aset (cdr context) 10 signers))
+
(defun epg-context-set-process (context process)
"Set the process object of `epg-gpg-program'.
This function is for internal use only."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aset (cdr context) 10 process))
+ (aset (cdr context) 11 process))
(defun epg-context-set-output-file (context output-file)
"Set the output file of `epg-gpg-program'.
This function is for internal use only."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aset (cdr context) 11 output-file))
+ (aset (cdr context) 12 output-file))
(defun epg-context-set-result (context result)
"Set the result of the previous cryptographic operation."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aset (cdr context) 12 result))
+ (aset (cdr context) 13 result))
(defun epg-context-set-operation (context operation)
"Set the name of the current cryptographic operation."
(unless (eq (car-safe context) 'epg-context)
(signal 'wrong-type-argument (list 'epg-context-p context)))
- (aset (cdr context) 13 operation))
+ (aset (cdr context) 14 operation))
(defun epg-make-signature (status &optional key-id)
"Return a signature object."
(signal 'wrong-type-argument (list 'epg-key-signature-p key-signature)))
(aref (cdr key-signature) 7))
+(defun epg-make-sig-notation (name value &optional human-readable critical)
+ "Return a notation object."
+ (cons 'epg-sig-notation (vector name value human-readable critical)))
+
+(defun epg-sig-notation-name (sig-notation)
+ "Return the name of SIG-NOTATION."
+ (unless (eq (car-safe sig-notation) 'epg-sig-notation)
+ (signal 'wrong-type-argument (list 'epg-sig-notation-p sig-notation)))
+ (aref (cdr sig-notation) 0))
+
+(defun epg-sig-notation-value (sig-notation)
+ "Return the value of SIG-NOTATION."
+ (unless (eq (car-safe sig-notation) 'epg-sig-notation)
+ (signal 'wrong-type-argument (list 'epg-sig-notation-p sig-notation)))
+ (aref (cdr sig-notation) 1))
+
+(defun epg-sig-notation-human-readable (sig-notation)
+ "Return the human-readable of SIG-NOTATION."
+ (unless (eq (car-safe sig-notation) 'epg-sig-notation)
+ (signal 'wrong-type-argument (list 'epg-sig-notation-p sig-notation)))
+ (aref (cdr sig-notation) 2))
+
+(defun epg-sig-notation-critical (sig-notation)
+ "Return the critical of SIG-NOTATION."
+ (unless (eq (car-safe sig-notation) 'epg-sig-notation)
+ (signal 'wrong-type-argument (list 'epg-sig-notation-p sig-notation)))
+ (aref (cdr sig-notation) 3))
+
(defun epg-context-result-for (context name)
"Return the result of CONTEXT associated with NAME."
(cdr (assq name (epg-context-result context))))
(defun epg--clear-string (string)
(fillarray string 0)))
+(defun epg--args-from-sig-notations (notations)
+ (apply #'nconc
+ (mapcar
+ (lambda (notation)
+ (if (and (epg-sig-notation-name notation)
+ (not (epg-sig-notation-human-readable notation)))
+ (error "Unreadable"))
+ (if (epg-sig-notation-name notation)
+ (list "--sig-notation"
+ (if (epg-sig-notation-critical notation)
+ (concat "!" (epg-sig-notation-name notation)
+ "=" (epg-sig-notation-value notation))
+ (concat (epg-sig-notation-name notation)
+ "=" (epg-sig-notation-value notation))))
+ (list "--sig-policy-url" (epg-sig-notation-value notation))))
+ notations))
+
;;;###autoload
(defun epg-cancel (context)
(if (buffer-live-p (process-buffer (epg-context-process context)))
`epg-sign-file' or `epg-sign-string' instead."
(epg-context-set-operation context 'sign)
(epg-context-set-result context nil)
- (unless (memq mode '(t detached nil normal))
+ (unless (memq mode '(t detached nil normal)) ;i.e. cleartext
(epg-context-set-armor context nil)
(epg-context-set-textmode context nil))
(epg--start context
(epg-sub-key-id
(car (epg-key-sub-key-list signer)))))
(epg-context-signers context)))
+ (epg--args-from-sig-notations (epg-context-sig-notations))
(if (epg-data-file plain)
(list "--" (epg-data-file plain)))))
;; `gpgsm' does not read passphrase from stdin, so waiting is not needed.
(epg--start context
(append (if always-trust '("--always-trust"))
(if recipients '("--encrypt") '("--symmetric"))
+ (if sign '("--sign"))
+ (if sign
+ (apply #'nconc
+ (mapcar
+ (lambda (signer)
+ (list "-u"
+ (epg-sub-key-id
+ (car (epg-key-sub-key-list
+ signer)))))
+ (epg-context-signers context))))
(if sign
- (cons "--sign"
- (apply #'nconc
- (mapcar
- (lambda (signer)
- (list "-u"
- (epg-sub-key-id
- (car (epg-key-sub-key-list
- signer)))))
- (epg-context-signers context)))))
+ (epg--args-from-sig-notations
+ (epg-context-sig-notations)))
(apply #'nconc
(mapcar
(lambda (recipient)