fix ECIES to work with the rewrite
This commit is contained in:
parent
7e6d7ccb1c
commit
8b5a36f44e
@ -14,20 +14,23 @@ module Crypto.PubKey.ECIES
|
|||||||
|
|
||||||
import Crypto.ECC
|
import Crypto.ECC
|
||||||
import Crypto.Random
|
import Crypto.Random
|
||||||
|
import Crypto.Internal.Proxy
|
||||||
|
|
||||||
-- | Generate random a new Shared secret and the associated point
|
-- | Generate random a new Shared secret and the associated point
|
||||||
-- to do a ECIES style encryption
|
-- to do a ECIES style encryption
|
||||||
deriveEncrypt :: (MonadRandom randomly, EllipticCurveDH curve)
|
deriveEncrypt :: (MonadRandom randomly, EllipticCurveDH curve)
|
||||||
=> Point curve -- ^ the public key of the receiver
|
=> proxy curve -- ^ representation of the curve
|
||||||
|
-> Point curve -- ^ the public key of the receiver
|
||||||
-> randomly (Point curve, SharedSecret)
|
-> randomly (Point curve, SharedSecret)
|
||||||
deriveEncrypt pub = do
|
deriveEncrypt proxy pub = do
|
||||||
(KeyPair rPoint rScalar) <- curveGenerateKeyPair
|
(KeyPair rPoint rScalar) <- curveGenerateKeyPair proxy
|
||||||
return (rPoint, ecdh rScalar pub)
|
return (rPoint, ecdh proxy rScalar pub)
|
||||||
|
|
||||||
-- | Derive the shared secret with the receiver key
|
-- | Derive the shared secret with the receiver key
|
||||||
-- and the R point of the scheme.
|
-- and the R point of the scheme.
|
||||||
deriveDecrypt :: EllipticCurveDH curve
|
deriveDecrypt :: EllipticCurveDH curve
|
||||||
=> Point curve -- ^ The received R (supposedly, randomly generate on the encrypt side)
|
=> proxy curve -- ^ representation of the curve
|
||||||
|
-> Point curve -- ^ The received R (supposedly, randomly generated on the encrypt side)
|
||||||
-> Scalar curve -- ^ The secret key of the receiver
|
-> Scalar curve -- ^ The secret key of the receiver
|
||||||
-> SharedSecret
|
-> SharedSecret
|
||||||
deriveDecrypt point secret = ecdh secret point
|
deriveDecrypt proxy point secret = ecdh proxy secret point
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user