diff options
Diffstat (limited to 'gpg/skeybase/src/main/scala/com/github/jodersky/skeybase/openpgp/GnuPG.scala')
-rw-r--r-- | gpg/skeybase/src/main/scala/com/github/jodersky/skeybase/openpgp/GnuPG.scala | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gpg/skeybase/src/main/scala/com/github/jodersky/skeybase/openpgp/GnuPG.scala b/gpg/skeybase/src/main/scala/com/github/jodersky/skeybase/openpgp/GnuPG.scala index 3b2d152..befc18c 100644 --- a/gpg/skeybase/src/main/scala/com/github/jodersky/skeybase/openpgp/GnuPG.scala +++ b/gpg/skeybase/src/main/scala/com/github/jodersky/skeybase/openpgp/GnuPG.scala @@ -5,17 +5,16 @@ import java.io.File import scala.sys.process._ import java.io.ByteArrayInputStream import scala.collection.mutable.ArrayBuffer -import verification.VerificationException import scala.util.Try class GnuPG( val home: File = new File("."), - val command: String = "/usr/bin/gpg") + val command: String = "gpg") extends Backend { import GnuPG._ - private val _gpg = s"${command} --home=${home.getAbsolutePath} --no-default-keyring --keyring=temp.gpg --status-fd=2" + private val _gpg = s"${command} --home=${home.getAbsolutePath} --no-default-keyring --keyring=keybase.gpg --status-fd=2" private def gpg(args: String) = _gpg + " " + args def importKey(key: String) = { @@ -23,13 +22,13 @@ class GnuPG( result == 0 } - def verifySignature(statement: String, fingerprint: String): Try[String] = Try{ + def verifySignature(message: String, fingerprint: String): Try[String] = Try{ val stdout = new StringBuilder val stderr = new ArrayBuffer[String] - val status = (gpg("-d -") #< stream(statement)) ! ProcessLogger(stdout append _, stderr append _) + val status = (gpg("-d -") #< stream(message)) ! ProcessLogger(stdout append _, stderr append _) - if (status != 0) throw new VerificationException("gpg exited with non-zero exit code") + if (status != 0) throw new VerificationException("GnuPG exited with non-zero exit code. Stderr: \n" + stderr.mkString("\n")) /* see doc/DETAILS of GnuPG for more information about structure */ def fpr(line: String) = """\[GNUPG:\] VALIDSIG (\S+\s+){9}(\w+)""".r findPrefixMatchOf (line) map { m => |