summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-12-05 13:58:53 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-12-05 13:58:53 -0400
commite6a9043dfe2ca5b82081f056cdfff4ed5fdfec93 (patch)
treef79fb62580f04bce35788e32985e3e5795926cf0
parentb928dc64041b7e3e19f7f8787cc1e38fb5b465ed (diff)
fix gpg subkey support typo
initremote, enableremote: Really support gpg subkeys suffixed with an exclamation mark, which forces gpg to use a specific subkey. (Previous try had a bug.) This commit was sponsored by Jake Vosloo on Patreon.
-rw-r--r--CHANGELOG3
-rw-r--r--Utility/Gpg.hs2
-rw-r--r--doc/bugs/GPG_subkeys.mdwn17
3 files changed, 21 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0cfbcfdf9..b97c8d611 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,9 @@ git-annex (6.20171125) UNRELEASED; urgency=medium
not media files.
* Removed no longer needed dependency on yesod-default.
* Allow exporttree remotes to be marked as dead.
+ * initremote, enableremote: Really support gpg subkeys suffixed with an
+ exclamation mark, which forces gpg to use a specific subkey.
+ (Previous try had a bug.)
-- Joey Hess <id@joeyh.name> Tue, 28 Nov 2017 13:48:44 -0400
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs
index 94d588cd7..2ffb0add6 100644
--- a/Utility/Gpg.hs
+++ b/Utility/Gpg.hs
@@ -171,7 +171,7 @@ findPubKeys cmd for
{- "subkey!" tells gpg to force use of a specific subkey -}
isForcedSubKey :: String -> Bool
-isForcedSubKey s = "!" `isSuffixOf` s && all isHexDigit (drop 1 s)
+isForcedSubKey s = "!" `isSuffixOf` s && all isHexDigit (drop 1 (reverse s))
type UserId = String
diff --git a/doc/bugs/GPG_subkeys.mdwn b/doc/bugs/GPG_subkeys.mdwn
index d3eedf4b9..917ec9002 100644
--- a/doc/bugs/GPG_subkeys.mdwn
+++ b/doc/bugs/GPG_subkeys.mdwn
@@ -28,3 +28,20 @@ OS X 10.10.5
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
I love git annex. Thank you for your work on it.
+> Yeah, so I had that working before but then I tightened the
+> code to determine what is a forced subkey and broke it.
+>
+> [Fixed now; use a "!" at the _end_ to force subkey use:
+
+ joey@darkstar:~/tmp/a>git annex initremote testing type=directory directory=../d encryption=hybrid keyid='A4FEC0B5F031BA70!'
+ initremote testing (encryption setup) gpg: A4FEC0B5F031BA70!: skipped: Unusable public key
+ gpg: [stdin]: encryption failed: Unusable public key
+
+> It failed to use that subkey because it is a sign-only key,
+> and git-annex needs to encrypt, but that certainly shows I got
+> git-annex to use the subkey..
+>
+> I made an encrypt-only subkey, and git-annex is able to use it,
+> and it fully works as far as I can tell.
+>
+> [[done]] --[[Joey]]