English

Gauche-_gpgme

Gauche-_gpgmeはGPGMEをGaucheから操作するための拡張です。

ダウンロード: Gauche-_gpgme-1.1.4.tgz (2018-12-21)

履歴

使い方

(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))))))