 | HsOpenSSL-0.3: (Part of) OpenSSL binding for Haskell | Contents | Index |
|
|
|
|
|
| Description |
| An interface to RSA public key generator.
|
|
| Synopsis |
|
|
|
|
| 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 |
| :: Int | The number of bits of the public modulus
(i.e. key size). Key sizes with n < 1024
should be considered insecure.
| | -> Int | The public exponent. It is an odd number,
typically 3, 17 or 65537.
| | -> Maybe RSAGenKeyCallback | A callback function.
| | -> IO RSA | The 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 |