HsOpenSSL-0.6: (Incomplete) OpenSSL binding for HaskellSource codeContentsIndex
OpenSSL.RSA
Contents
Type
Generating keypair
Exploring keypair
Description
An interface to RSA public key generator.
Synopsis
class RSAKey k where
rsaSize :: k -> Int
rsaN :: k -> Integer
rsaE :: k -> Integer
withRSAPtr :: k -> (Ptr RSA -> IO a) -> IO a
peekRSAPtr :: Ptr RSA -> IO (Maybe k)
absorbRSAPtr :: Ptr RSA -> IO (Maybe k)
data RSAPubKey
data RSAKeyPair
type RSAGenKeyCallback = Int -> Int -> IO ()
generateRSAKey :: Int -> Int -> Maybe RSAGenKeyCallback -> IO RSAKeyPair
generateRSAKey' :: Int -> Int -> IO RSAKeyPair
rsaD :: RSAKeyPair -> Integer
rsaP :: RSAKeyPair -> Integer
rsaQ :: RSAKeyPair -> Integer
rsaDMP1 :: RSAKeyPair -> Maybe Integer
rsaDMQ1 :: RSAKeyPair -> Maybe Integer
rsaIQMP :: RSAKeyPair -> Maybe Integer
Type
class RSAKey k whereSource
RSAKey a is either RSAPubKey or RSAKeyPair.
Methods
rsaSize :: k -> IntSource
rsaSize key returns the length of key.
rsaN :: k -> IntegerSource
rsaN key returns the public modulus of the key.
rsaE :: k -> IntegerSource
rsaE key returns the public exponent of the key.
withRSAPtr :: k -> (Ptr RSA -> IO a) -> IO aSource
peekRSAPtr :: Ptr RSA -> IO (Maybe k)Source
absorbRSAPtr :: Ptr RSA -> IO (Maybe k)Source
show/hide Instances
data RSAPubKey Source
RSAPubKey is an opaque object that represents RSA public key.
show/hide Instances
data RSAKeyPair Source
RSAKeyPair is an opaque object that represents RSA keypair.
show/hide Instances
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.
generateRSAKeySource
:: 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 RSAKeyPairThe generated keypair.
generateRSAKey generates an RSA keypair.
generateRSAKey'Source
:: 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.
-> IO RSAKeyPairThe generated keypair.
A simplified alternative to generateRSAKey
Exploring keypair
rsaD :: RSAKeyPair -> IntegerSource
rsaD privKey returns the private exponent of the key.
rsaP :: RSAKeyPair -> IntegerSource
rsaP privkey returns the secret prime factor p of the key.
rsaQ :: RSAKeyPair -> IntegerSource
rsaQ privkey returns the secret prime factor q of the key.
rsaDMP1 :: RSAKeyPair -> Maybe IntegerSource
rsaDMP1 privkey returns d mod (p-1) of the key.
rsaDMQ1 :: RSAKeyPair -> Maybe IntegerSource
rsaDMQ1 privkey returns d mod (q-1) of the key.
rsaIQMP :: RSAKeyPair -> Maybe IntegerSource
rsaIQMP privkey returns q^-1 mod p of the key.
Produced by Haddock version 2.4.2