HsOpenSSL-0.1.1: (Part of) OpenSSL binding for HaskellContentsIndex
OpenSSL.RSA
Contents
Type
Generating keypair
Exploring keypair
Description
An interface to RSA public key generator.
Synopsis
data RSA
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)
Type
data RSA
RSA is an opaque object that represents either RSA public key or public/private keypair.
Generating keypair
type RSAGenKeyCallback = Int -> Int -> IO ()

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.
generateKey
:: 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 Integer
rsaN pubKey returns the public modulus of the key.
rsaE :: RSA -> IO Integer
rsaE pubKey returns the public exponent of the key.
rsaD :: RSA -> IO (Maybe Integer)
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)
rsaP privkey returns the secret prime factor p of the key.
rsaQ :: RSA -> IO (Maybe Integer)
rsaQ privkey returns the secret prime factor q of the key.
rsaDMP1 :: RSA -> IO (Maybe Integer)
rsaDMP1 privkey returns d mod (p-1) of the key.
rsaDMQ1 :: RSA -> IO (Maybe Integer)
rsaDMQ1 privkey returns d mod (q-1) of the key.
rsaIQMP :: RSA -> IO (Maybe Integer)
rsaIQMP privkey returns q^-1 mod p of the key.
Produced by Haddock version 0.8