HsOpenSSL-0.5: (Part of) OpenSSL binding for HaskellSource codeContentsIndex
Generating keypair
Exploring keypair
An interface to RSA public key generator.
data RSA
data RSA_
withRSAPtr :: RSA -> (Ptr RSA_ -> IO a) -> IO a
type RSAGenKeyCallback = Int -> Int -> IO ()
generateKey :: Int -> Int -> Maybe RSAGenKeyCallback -> IO RSA
rsaN :: RSA -> IO Integer
rsaE :: RSA -> IO Integer
rsaD :: RSA -> IO (Maybe Integer)
rsaP :: RSA -> IO (Maybe Integer)
rsaQ :: RSA -> IO (Maybe Integer)
rsaDMP1 :: RSA -> IO (Maybe Integer)
rsaDMQ1 :: RSA -> IO (Maybe Integer)
rsaIQMP :: RSA -> IO (Maybe Integer)
data RSA Source
RSA is an opaque object that represents either RSA public key or public/private keypair.
data RSA_ Source
withRSAPtr :: RSA -> (Ptr RSA_ -> IO a) -> IO aSource
Generating keypair
type RSAGenKeyCallback = Int -> Int -> IO ()Source

RSAGenKeyCallback represents a callback function to get informed the progress of RSA key generation.

  • callback 0 i is called after generating the i-th potential prime number.
  • While the number is being tested for primality, callback 1 j is called after the j-th iteration (j = 0, 1, ...).
  • When the n-th randomly generated prime is rejected as not suitable for the key, callback 2 n is called.
  • When a random p has been found with p-1 relatively prime to e, it is called as callback 3 0.
  • The process is then repeated for prime q with callback 3 1.
:: IntThe number of bits of the public modulus (i.e. key size). Key sizes with n < 1024 should be considered insecure.
-> IntThe public exponent. It is an odd number, typically 3, 17 or 65537.
-> Maybe RSAGenKeyCallbackA callback function.
-> IO RSAThe generated keypair.
generateKey generates an RSA keypair.
Exploring keypair
rsaN :: RSA -> IO IntegerSource
rsaN pubKey returns the public modulus of the key.
rsaE :: RSA -> IO IntegerSource
rsaE pubKey returns the public exponent of the key.
rsaD :: RSA -> IO (Maybe Integer)Source
rsaD privKey returns the private exponent of the key. If privKey is not really a private key, the result is Nothing.
rsaP :: RSA -> IO (Maybe Integer)Source
rsaP privkey returns the secret prime factor p of the key.
rsaQ :: RSA -> IO (Maybe Integer)Source
rsaQ privkey returns the secret prime factor q of the key.
rsaDMP1 :: RSA -> IO (Maybe Integer)Source
rsaDMP1 privkey returns d mod (p-1) of the key.
rsaDMQ1 :: RSA -> IO (Maybe Integer)Source
rsaDMQ1 privkey returns d mod (q-1) of the key.
rsaIQMP :: RSA -> IO (Maybe Integer)Source
rsaIQMP privkey returns q^-1 mod p of the key.
Produced by Haddock version 2.4.2