diff options
Diffstat (limited to 'Data/OpenPGP/Util/Cv25519.hs')
-rw-r--r-- | Data/OpenPGP/Util/Cv25519.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Data/OpenPGP/Util/Cv25519.hs b/Data/OpenPGP/Util/Cv25519.hs index d5ac641..abf1ba6 100644 --- a/Data/OpenPGP/Util/Cv25519.hs +++ b/Data/OpenPGP/Util/Cv25519.hs | |||
@@ -230,13 +230,17 @@ decryptMessage ecdhkey asym encdta = do | |||
230 | (_,_, Message ps) <- either (const Nothing) Just $ decodeOrFail b1 | 230 | (_,_, Message ps) <- either (const Nothing) Just $ decodeOrFail b1 |
231 | return ps | 231 | return ps |
232 | 232 | ||
233 | importSecretCv25519 :: Cv25519.SecretKey -> [(Char,MPI)] | 233 | encodeAlgorithms :: OpenPGP.HashAlgorithm -> OpenPGP.SymmetricAlgorithm -> Integer |
234 | importSecretCv25519 k = | 234 | encodeAlgorithms hsh sym = fromIntegral $ 0x03010000 .|. (fromEnum hsh `shiftR` 8) .|. fromEnum sym |
235 | |||
236 | importSecretCv25519 :: OpenPGP.HashAlgorithm -> OpenPGP.SymmetricAlgorithm -> Cv25519.SecretKey -> [(Char,MPI)] | ||
237 | importSecretCv25519 hsh sym k = | ||
235 | [ ('c', MPI oid_cv25519) | 238 | [ ('c', MPI oid_cv25519) |
236 | , ('l', MPI 128) | 239 | , ('l', MPI 128) |
237 | , ('n', MPI pub) | 240 | , ('n', MPI pub) |
238 | , ('f', MPI 0x40) | 241 | , ('f', MPI 0x40) |
239 | , ('d', MPI sec) | 242 | , ('d', MPI sec) |
243 | , ('e', MPI $ encodeAlgorithms hsh sym) | ||
240 | ] | 244 | ] |
241 | where | 245 | where |
242 | pub = getBigNum $ BA.convert $ Cv25519.toPublic k | 246 | pub = getBigNum $ BA.convert $ Cv25519.toPublic k |