HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

ModuleHsOpenSSL-0.11.7.10Haskell2010

OpenSSL.RSA

An interface to RSA public key generator.

  • 4 types
  • 1 class
  • 10 values
  • PackageHsOpenSSL-0.11.7.10
  • Exports15
  • LanguageHaskell2010
  • LicenceLicenseRef-PublicDomain
  • SourceRSA.hsc

Type

4 declarations
classclass RSAKey k where
#

RSAKey a is either RSAPubKey or RSAKeyPair.

Methods

Instances2RSAKey
newtypenewtype RSAPubKey
#

RSAPubKey is an opaque object that represents RSA public key.

Instances6Eq, Ord, Show, RSAKey, PKey, PublicKey
newtypenewtype RSAKeyPair
#

RSAKeyPair is an opaque object that represents RSA keypair.

Instances7Eq, Ord, Show, RSAKey, PKey, KeyPair, …

Generating keypair

3 declarations
typetype 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.

valuegenerateRSAKey'
  1. :: Int

    The number of bits of the public modulus (i.e. key size). Key sizes with n < 1024 should be considered insecure.

  2. -> Int

    The public exponent. It is an odd number, typically 3, 17 or 65537.

  3. -> IO RSAKeyPair

    The generated keypair.

#

A simplified alternative to generateRSAKey

Exploring keypair

8 declarations