module Crypto.Gpgme.Types where
import Bindings.Gpgme
import qualified Data.ByteString as BS
import Foreign
data Protocol =
CMS
| GPGCONF
| OpenPGP
| UNKNOWN
data Ctx = Ctx {
_ctx :: Ptr C'gpgme_ctx_t
, _version :: String
}
type Fpr = BS.ByteString
type Plain = BS.ByteString
type Encrypted = BS.ByteString
type InvalidKey = (String, Int)
newtype Key = Key { unKey :: Ptr C'gpgme_key_t }
data IncludeSecret =
WithSecret
| NoSecret
data Flag =
AlwaysTrust
| NoFlag
data DecryptError =
NoData
| Failed
| BadPass
| Unknown Int
deriving (Eq, Show)
toDecryptError :: C'gpgme_err_code_t -> DecryptError
toDecryptError 58 = NoData
toDecryptError 152 = Failed
toDecryptError 11 = BadPass
toDecryptError x = Unknown (fromIntegral x)