diff options
author | Joey Hess <joey@kitenet.net> | 2011-04-17 18:18:27 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-04-17 18:18:27 -0400 |
commit | 86f7feb2784221459d4015b0d70f537dbf2e9bb7 (patch) | |
tree | 3eb005b9a1c98fe24494ec407adb59323eaabe94 | |
parent | a91a51fc03a68f2a5ede6df5182471f6ebfcc037 (diff) |
initremote: show gpg keys
-rw-r--r-- | Crypto.hs | 8 | ||||
-rw-r--r-- | Remote/Encryptable.hs | 7 | ||||
-rw-r--r-- | doc/walkthrough/using_Amazon_S3.mdwn | 2 |
3 files changed, 13 insertions, 4 deletions
@@ -13,6 +13,7 @@ module Crypto ( EncryptedCipher, genCipher, updateCipher, + describeCipher, storeCipher, extractCipher, decryptCipher, @@ -95,6 +96,13 @@ updateCipher c encipher@(EncryptedCipher _ ks) = do where combine (KeyIds a) (KeyIds b) = KeyIds $ a ++ b +describeCipher :: EncryptedCipher -> String +describeCipher (EncryptedCipher _ (KeyIds ks)) = + "with gpg " ++ keys ks ++ " " ++ unwords ks + where + keys [_] = "key" + keys _ = "keys" + {- Stores an EncryptedCipher in a remote's configuration. -} storeCipher :: RemoteConfig -> EncryptedCipher -> RemoteConfig storeCipher c (EncryptedCipher t ks) = diff --git a/Remote/Encryptable.hs b/Remote/Encryptable.hs index 11df2673c..493ff1214 100644 --- a/Remote/Encryptable.hs +++ b/Remote/Encryptable.hs @@ -27,11 +27,12 @@ encryptionSetup c = (Just "none", Nothing) -> return c (Just "none", Just _) -> error "Cannot change encryption type of existing remote." (Nothing, Just _) -> return c - (Just _, Nothing) -> use $ genCipher c - (Just _, Just v) -> use $ updateCipher c v + (Just _, Nothing) -> use "encryption setup" $ genCipher c + (Just _, Just v) -> use "encryption updated" $ updateCipher c v where - use a = do + use m a = do cipher <- liftIO a + showNote $ m ++ " " ++ describeCipher cipher return $ M.delete "encryption" $ storeCipher c cipher {- Modifies a Remote to support encryption. diff --git a/doc/walkthrough/using_Amazon_S3.mdwn b/doc/walkthrough/using_Amazon_S3.mdwn index a0ce951a8..c84258354 100644 --- a/doc/walkthrough/using_Amazon_S3.mdwn +++ b/doc/walkthrough/using_Amazon_S3.mdwn @@ -15,7 +15,7 @@ like "2512E3C7" Next, create the S3 remote, and describe it. # git annex initremote cloud type=S3 encryption=2512E3C7 - initremote cloud (checking bucket) (creating bucket in US) ok + initremote cloud (encryption setup with gpg key C910D9222512E3C7) (checking bucket) (creating bucket in US) ok # git annex describe cloud "at Amazon's US datacenter" describe cloud ok |