Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
An interface to RSA public key generator.
Synopsis
- class RSAKey k where
- 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
- rsaCopyPublic :: RSAKey key => key -> IO RSAPubKey
Type
is either RSAKey
aRSAPubKey
or RSAKeyPair
.
returns the length of key.rsaSize
key
returns the public modulus of the key.rsaN
key
returns the public exponent of the key.rsaE
key
withRSAPtr :: k -> (Ptr RSA -> IO a) -> IO a Source #
Instances
RSAKey RSAKeyPair Source # | |
Defined in OpenSSL.RSA rsaSize :: RSAKeyPair -> Int Source # rsaN :: RSAKeyPair -> Integer Source # rsaE :: RSAKeyPair -> Integer Source # withRSAPtr :: RSAKeyPair -> (Ptr RSA -> IO a) -> IO a Source # peekRSAPtr :: Ptr RSA -> IO (Maybe RSAKeyPair) Source # absorbRSAPtr :: Ptr RSA -> IO (Maybe RSAKeyPair) Source # | |
RSAKey RSAPubKey Source # | |
Defined in OpenSSL.RSA |
is an opaque object that represents RSA public key.RSAPubKey
data RSAKeyPair Source #
is an opaque object that represents RSA keypair.RSAKeyPair
Instances
Generating keypair
type RSAGenKeyCallback = Int -> Int -> IO () Source #
represents a callback function to get
informed the progress of RSA key generation.RSAGenKeyCallback
callback 0 i
is called after generating thei
-th potential prime number.- While the number is being tested for primality,
callback 1 j
is called after thej
-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 withp
-1 relatively prime toe
, it is called ascallback 3 0
. - The process is then repeated for prime
q
withcallback 3 1
.
:: Int | The number of bits of the public modulus
(i.e. key size). Key sizes with |
-> Int | The public exponent. It is an odd number, typically 3, 17 or 65537. |
-> Maybe RSAGenKeyCallback | A callback function. |
-> IO RSAKeyPair | The generated keypair. |
generates an RSA keypair.generateRSAKey
:: Int | The number of bits of the public modulus
(i.e. key size). Key sizes with |
-> Int | The public exponent. It is an odd number, typically 3, 17 or 65537. |
-> IO RSAKeyPair | The generated keypair. |
A simplified alternative to generateRSAKey