Japanese

Gauche-_gpgme

Gauche-_gpgme is a GPGME biding for Gauche.

Download: Gauche-_gpgme-1.1.4.tgz (2018-12-21)

History

Example

(use crypt.gpgme)
(use gauche.collection)

(init-gpgme)

(define (passphrase-cb opaque uid-hint passphrase-info last-was-bad oport)
  (format oport "foobar\n")
  0)

(call-with-gpgme-context
 (^(ctx)
   (with-gpgme-armor
    ctx
    (guard
        (exc
         [(gpgme-error? exc)
          (format #t "~a~a\n"
                  (gpgme-error-debug-info exc)
                  (gpgme-error-reason exc))])
      (let ([encrypt-string "Encrypt string.\n"]
            [out (open-output-string)])

        ;;; Using key
        (gpgme-encrypt-string ctx encrypt-string '("foo@hoge.com")
                              GPGME-ENCRYPT-ALWAYS-TRUST
                              :passphrase-cb passphrase-cb
                              :oport out)
        (format #t "Encrypt string [~a]\n" (get-output-string out))
        (format #t "\nDecrypt\n")
        (gpgme-decrypt-string ctx (get-output-string out)
                              :passphrase-cb passphrase-cb))))))