diff options
author | 2012-04-29 14:02:18 -0400 | |
---|---|---|
committer | 2012-04-29 14:02:43 -0400 | |
commit | 1c16f616df9a8469d24cefb6007333df3a35a449 (patch) | |
tree | 2198232da7d7594d1a8d952724497c08ee22d2ce /Utility | |
parent | d7a4a9a66bd51b18a9e5f4427c3492db1adec40d (diff) |
Added shared cipher mode to encryptable special remotes.
This option avoids gpg key distribution, at the expense of flexability, and
with the requirement that all clones of the git repository be equally
trusted.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Gpg.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Utility/Gpg.hs b/Utility/Gpg.hs index 4c798f273..ff6735ba5 100644 --- a/Utility/Gpg.hs +++ b/Utility/Gpg.hs @@ -94,7 +94,18 @@ findPubKeys for = KeyIds . parse <$> readStrict params pubKey = isPrefixOf "pub:" keyIdField s = split ":" s !! 4 - +{- Creates a block of high-quality random data suitable to use as a cipher. + - It is armored, to avoid newlines, since gpg only reads ciphers up to the + - first newline. -} +genRandom :: Int -> IO String +genRandom size = readStrict + [ Params "--gen-random --armor" + , Param $ show randomquality + , Param $ show size + ] + where + -- 1 is /dev/urandom; 2 is /dev/random + randomquality = 1 :: Int {- A test key. This is provided pre-generated since generating a new gpg - key is too much work (requires too much entropy) for a test suite to |