diff options
-rw-r--r-- | lib/KeyRing.hs | 86 |
1 files changed, 23 insertions, 63 deletions
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs index f8e2290..bd6de27 100644 --- a/lib/KeyRing.hs +++ b/lib/KeyRing.hs | |||
@@ -28,36 +28,24 @@ module KeyRing (module KeyRing.Types, module Transforms, module PacketTranscoder | |||
28 | 28 | ||
29 | import System.Environment | 29 | import System.Environment |
30 | import Control.Monad | 30 | import Control.Monad |
31 | import Control.Exception ( catch ) | ||
32 | import System.IO.Error ( isDoesNotExistError ) | ||
33 | import Data.Bool | 31 | import Data.Bool |
34 | import Data.Maybe | 32 | import Data.Maybe |
35 | import Data.Either | 33 | import Data.Either |
36 | import Data.Char | 34 | import Data.Char |
37 | import Data.Ord | ||
38 | import Data.List | 35 | import Data.List |
39 | import Data.OpenPGP | 36 | import Data.OpenPGP |
40 | import Data.Functor | ||
41 | import Data.Monoid | ||
42 | import Data.Tuple ( swap ) | ||
43 | import Data.Bits ( (.|.), (.&.) ) | ||
44 | import Control.Applicative ( Applicative, pure, liftA2, (<*>) ) | ||
45 | import System.Directory ( getHomeDirectory, doesFileExist, createDirectoryIfMissing ) | 37 | import System.Directory ( getHomeDirectory, doesFileExist, createDirectoryIfMissing ) |
46 | import Control.Arrow ( first, second ) | 38 | import Control.Arrow ( first, second ) |
47 | import Data.OpenPGP.Util | 39 | import Data.OpenPGP.Util |
48 | import Data.ByteString.Lazy ( ByteString ) | 40 | import Data.ByteString.Lazy ( ByteString ) |
49 | import Text.Show.Pretty as PP ( ppShow ) | ||
50 | import Data.Binary {- decode, decodeOrFail -} | 41 | import Data.Binary {- decode, decodeOrFail -} |
51 | import ControlMaybe ( handleIO_ ) | 42 | import ControlMaybe ( handleIO_ ) |
52 | import Data.ASN1.Types ( toASN1, ASN1Object, fromASN1 | 43 | import Data.ASN1.Types ( toASN1, ASN1Object, fromASN1 |
53 | , ASN1(Start,End,IntVal,OID,BitString,Null), ASN1ConstructionType(Sequence) ) | 44 | , ASN1(Start,End,IntVal,OID,BitString,Null), ASN1ConstructionType(Sequence) ) |
54 | import Data.ASN1.BitArray ( BitArray(..), toBitArray ) | 45 | import Data.ASN1.BitArray ( BitArray(..), toBitArray ) |
55 | import Data.ASN1.Encoding ( encodeASN1, encodeASN1', decodeASN1, decodeASN1' ) | 46 | import Data.ASN1.Encoding (decodeASN1', encodeASN1, encodeASN1' ) |
56 | import Data.ASN1.BinaryEncoding ( DER(..) ) | 47 | import Data.ASN1.BinaryEncoding ( DER(..) ) |
57 | import Data.Time.Clock.POSIX ( POSIXTime, utcTimeToPOSIXSeconds ) | 48 | import Data.Bits ((.&.), shiftR ) |
58 | import Data.Time.Clock ( UTCTime ) | ||
59 | import Data.Bits ( Bits, shiftR ) | ||
60 | import Data.Text.Encoding ( encodeUtf8 ) | ||
61 | import qualified Data.Map as Map | 49 | import qualified Data.Map as Map |
62 | import qualified Data.ByteString.Lazy as L | 50 | import qualified Data.ByteString.Lazy as L |
63 | import qualified Data.ByteString as S | 51 | import qualified Data.ByteString as S |
@@ -72,25 +60,15 @@ import qualified Codec.Binary.Base64 as Base64 | |||
72 | import qualified Crypto.Hash.SHA1 as SHA1 | 60 | import qualified Crypto.Hash.SHA1 as SHA1 |
73 | import qualified Crypto.Types.PubKey.ECC as ECC | 61 | import qualified Crypto.Types.PubKey.ECC as ECC |
74 | #else | 62 | #else |
75 | import qualified Crypto.Hash as Vincent | ||
76 | import Data.ByteArray (convert) | ||
77 | import qualified Crypto.PubKey.ECC.Types as ECC | ||
78 | #endif | 63 | #endif |
79 | import qualified Data.X509 as X509 | ||
80 | import qualified Crypto.PubKey.RSA as RSA | ||
81 | import qualified Codec.Compression.GZip as GZip | 64 | import qualified Codec.Compression.GZip as GZip |
82 | import qualified Data.Text as T ( Text, unpack, pack, | ||
83 | strip, reverse, drop, break, dropAround, length ) | ||
84 | import qualified System.Posix.Types as Posix | 65 | import qualified System.Posix.Types as Posix |
85 | import System.Posix.Files ( modificationTime, getFileStatus, getFdStatus | 66 | import System.Posix.Files (setFileCreationMask, setFileTimes ) |
86 | , setFileCreationMask, setFileTimes ) | 67 | |
87 | #if MIN_VERSION_x509(1,5,0) | 68 | #if MIN_VERSION_x509(1,5,0) |
88 | import Data.Hourglass.Types | ||
89 | import Data.Hourglass | ||
90 | #endif | 69 | #endif |
91 | #if MIN_VERSION_unix(2,7,0) | 70 | #if MIN_VERSION_unix(2,7,0) |
92 | import System.Posix.Files ( setFdTimesHiRes ) | 71 | import System.Posix.Files ( setFdTimesHiRes ) |
93 | import Foreign.C.Types ( CTime(..), CLong, CInt(..) ) | ||
94 | #else | 72 | #else |
95 | import Foreign.C.Types ( CTime(..), CLong, CInt(..) ) | 73 | import Foreign.C.Types ( CTime(..), CLong, CInt(..) ) |
96 | import Foreign.Marshal.Array ( withArray ) | 74 | import Foreign.Marshal.Array ( withArray ) |
@@ -100,59 +78,41 @@ import Foreign.Storable | |||
100 | #endif | 78 | #endif |
101 | import System.FilePath ( takeDirectory ) | 79 | import System.FilePath ( takeDirectory ) |
102 | import System.IO (hPutStrLn,withFile,IOMode(..), Handle, hPutStr, stderr, hClose) | 80 | import System.IO (hPutStrLn,withFile,IOMode(..), Handle, hPutStr, stderr, hClose) |
103 | import Data.IORef | ||
104 | import System.Posix.IO ( fdToHandle ) | 81 | import System.Posix.IO ( fdToHandle ) |
105 | import qualified Data.Traversable as Traversable | ||
106 | import Data.Traversable ( sequenceA ) | ||
107 | #if ! MIN_VERSION_base(4,6,0) | 82 | #if ! MIN_VERSION_base(4,6,0) |
108 | import GHC.Exts ( Down(..) ) | 83 | import GHC.Exts ( Down(..) ) |
109 | #endif | 84 | #endif |
110 | #if MIN_VERSION_binary(0,7,0) | 85 | #if MIN_VERSION_binary(0,7,0) |
111 | import Debug.Trace | ||
112 | #endif | 86 | #endif |
113 | import Network.Socket -- (SockAddr) | ||
114 | import qualified Data.ByteString.Lazy.Char8 as Char8 | 87 | import qualified Data.ByteString.Lazy.Char8 as Char8 |
115 | import qualified Codec.Encryption.OpenPGP.ASCIIArmor as ASCIIArmor | 88 | import qualified Codec.Encryption.OpenPGP.ASCIIArmor as ASCIIArmor |
116 | import Codec.Encryption.OpenPGP.ASCIIArmor.Types | 89 | import Codec.Encryption.OpenPGP.ASCIIArmor.Types |
117 | 90 | ||
118 | import Compat | ||
119 | import TimeUtil | ||
120 | import PEM | ||
121 | import ScanningParser | ||
122 | import qualified Hosts | 91 | import qualified Hosts |
123 | import qualified CryptoCoins | 92 | import qualified CryptoCoins |
124 | import Base58 | 93 | import Base58 |
125 | import FunctorToMaybe | 94 | import FunctorToMaybe |
126 | import DotLock | 95 | import DotLock |
127 | import ProcessUtils (systemEnv, ExitCode(ExitFailure, ExitSuccess) ) | 96 | import ProcessUtils (systemEnv, ExitCode(ExitFailure, ExitSuccess) ) |
128 | import GnuPGAgent as Agent | 97 | import KeyRing.BuildKeyDB (Hostnames(..), |
129 | import KeyRing.BuildKeyDB {- (accBindings, backsig, buildKeyDB, | 98 | IPsToWriteToHostsFile(..), |
130 | combineTransforms, concatSort, | 99 | buildKeyDB, |
131 | derRSA, derToBase32, filterMatches, | 100 | combineTransforms, |
132 | findTag, fingerdress, | 101 | filterMatches, |
133 | flattenAllUids, flattenKeys, | 102 | fingerdress, flattenKeys, |
134 | flattenSub, flattenTop, | 103 | generateInternals, |
135 | generateInternals, getBindings, | 104 | getHostnames, getSubkeys, |
136 | getHostnames, getSubkeys, | 105 | importSecretKey, |
137 | importSecretKey, insertSubkey, | 106 | insertSubkey, |
138 | isKey, isSecretKey, | 107 | matchSpec, merge, |
139 | isSubkeySignature, isUserID, | 108 | packetFromPublicRSAKey, |
140 | keyFlags0, keyPacket, keyflags, | 109 | parseCertBlob, |
141 | keykey, mappedPacket, matchSpec, | 110 | parseSingleSpec, |
142 | matchpr, merge, mergeKeyPacket, | 111 | parseSpec, readInputFileL, |
143 | mkUsage, origin, | 112 | readSecretPEMFile, |
144 | packetFromPublicRSAKey, | 113 | secp256k1_id, seek_key, |
145 | parseCertBlob, parseSingleSpec, | 114 | selectKey0, selectPublicKey, |
146 | parseSpec, parseUID, | 115 | usageFromFilter) |
147 | performManipulations, | ||
148 | readInputFileL, readSecretPEMFile, | ||
149 | resolveForReport, resolveInputFile, | ||
150 | rsaKeyFromPacket, secp256k1_id, | ||
151 | secretToPublic, seek_key, | ||
152 | selectKey0, selectPublicKey, | ||
153 | showPacket, sortByHint, | ||
154 | subkeyMappedPacket, torhash, | ||
155 | usageFromFilter) -} | ||
156 | 116 | ||
157 | import KeyRing.Types | 117 | import KeyRing.Types |
158 | import PacketTranscoder | 118 | import PacketTranscoder |