diff options
Diffstat (limited to 'Data/OpenPGP/Util/Gen.hs')
-rw-r--r-- | Data/OpenPGP/Util/Gen.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Data/OpenPGP/Util/Gen.hs b/Data/OpenPGP/Util/Gen.hs index ca3c684..c33ef1e 100644 --- a/Data/OpenPGP/Util/Gen.hs +++ b/Data/OpenPGP/Util/Gen.hs | |||
@@ -14,7 +14,9 @@ import qualified Crypto.PubKey.RSA as Vincent.RSA | |||
14 | import qualified Crypto.PubKey.RSA.PKCS15 as Vincent.RSA | 14 | import qualified Crypto.PubKey.RSA.PKCS15 as Vincent.RSA |
15 | import qualified Crypto.PubKey.ECC.ECDSA as Vincent.ECDSA | 15 | import qualified Crypto.PubKey.ECC.ECDSA as Vincent.ECDSA |
16 | #if defined(VERSION_cryptonite) | 16 | #if defined(VERSION_cryptonite) |
17 | import qualified Crypto.PubKey.Curve25519 as Cv25519 | ||
17 | import qualified Crypto.PubKey.Ed25519 as Ed25519 | 18 | import qualified Crypto.PubKey.Ed25519 as Ed25519 |
19 | import Data.OpenPGP.Util.Cv25519 | ||
18 | import Data.OpenPGP.Util.Ed25519 | 20 | import Data.OpenPGP.Util.Ed25519 |
19 | import Control.Arrow (second) | 21 | import Control.Arrow (second) |
20 | import Data.Binary | 22 | import Data.Binary |
@@ -25,6 +27,7 @@ import Data.OpenPGP.Util.Base | |||
25 | data GenerateKeyParams = GenRSA Int -- keysize | 27 | data GenerateKeyParams = GenRSA Int -- keysize |
26 | | GenDSA (Maybe DSAParams) | 28 | | GenDSA (Maybe DSAParams) |
27 | | GenEd25519 | 29 | | GenEd25519 |
30 | | GenCv25519 | ||
28 | deriving (Eq,Ord,Show) | 31 | deriving (Eq,Ord,Show) |
29 | 32 | ||
30 | data DSAParams = DSAParams | 33 | data DSAParams = DSAParams |
@@ -121,10 +124,10 @@ generateKey' (GenDSA mbparams) g = | |||
121 | generateKey' (GenEd25519 {}) g = withDRG g $ do | 124 | generateKey' (GenEd25519 {}) g = withDRG g $ do |
122 | k <- Ed25519.generateSecretKey | 125 | k <- Ed25519.generateSecretKey |
123 | return $ importSecretEd25519 k | 126 | return $ importSecretEd25519 k |
124 | -- file:///usr/share/doc/libghc-cryptonite-doc/html/Crypto-PubKey-Ed25519.html#v:generateSecretKey | 127 | generateKey' (GenCv25519 {}) g = withDRG g $ do |
125 | -- generateSecretKey :: MonadRandom m => m SecretKey | 128 | k <- Cv25519.generateSecretKey |
126 | -- n = public key used to verify signatures. | 129 | return $ importSecretCv25519 k |
127 | -- public_key_fields Ed25519 = ['c','l','x', 'y', 'n', 'f'] | 130 | |
128 | 131 | ||
129 | #endif | 132 | #endif |
130 | 133 | ||