HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

ModuleHsOpenSSL-0.11.7.11Haskell2010

OpenSSL.RSA

An interface to RSA public key generator.

Contents
  1. Type
  2. Generating keypair
  3. Exploring keypair
Synopsis
  • PackageHsOpenSSL-0.11.7.11
  • Exports15
  • LanguageHaskell2010
  • LicenceLicenseRef-PublicDomain
  • SourceRSA.hsc

Type

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

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