convert StorableCipher to ByteString

This allows getting rid of the ugly and error prone handling of
"bag of bytes" String in Remote.Helper.Encryptable.
Avoiding breakage like that dealt with by commit
9862d64bf9

And allows converting Utility.Gpg to use ByteString for IO, which is
a welcome change.

Tested the new git-annex interoperability with old, using all 3
encryption= types.

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
Joey Hess 2023-11-01 14:27:22 -04:00
parent be6b56df4c
commit c41ca6c832
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 45 additions and 68 deletions

View file

@ -25,6 +25,7 @@ import Utility.Gpg (KeyIds(..))
import Data.Typeable
import qualified Data.Map as M
import Data.ByteString (ByteString)
data EncryptionMethod
= NoneEncryption
@ -35,12 +36,12 @@ data EncryptionMethod
deriving (Typeable, Eq)
-- XXX ideally, this would be a locked memory region
data Cipher = Cipher String | MacOnlyCipher String
data Cipher = Cipher ByteString | MacOnlyCipher ByteString
data StorableCipher
= EncryptedCipher String EncryptedCipherVariant KeyIds
| SharedCipher String
| SharedPubKeyCipher String KeyIds
= EncryptedCipher ByteString EncryptedCipherVariant KeyIds
| SharedCipher ByteString
| SharedPubKeyCipher ByteString KeyIds
deriving (Ord, Eq)
data EncryptedCipherVariant = Hybrid | PubKey
deriving (Ord, Eq)