HORIZON HASKELLDocslts/ghc-9.14.xb2f3bfd2026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · b2f3bfd · 2026-10-11

Modulecrypton-2.1.7Haskell2010

Crypto.PubKey.RSA.PSS

  • 1 type
  • 10 values
  • Packagecrypton-2.1.7
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause AND MIT AND ISC
  • SourcePSS.hs

Sign and verify functions

8 declarations
valuesignWithSalt
  1. :: HashAlgorithm hash
  2. => ByteString

    Salt to use

  3. -> Maybe Blinder

    optional blinder to use

  4. -> PSSParams hash ByteString ByteString

    PSS Parameters to use

  5. -> PrivateKey

    RSA Private Key

  6. -> ByteString

    Message to sign

  7. -> Either Error ByteString
#

Sign using the PSS parameters and the salt explicitely passed as parameters.

the function ignore SaltLength from the PSS Parameters

See Blinder for what the optional blinder covers and when leaving it out is a decision rather than a default. signSafer generates one for you.

valuesignDigestWithSalt
  1. :: HashAlgorithm hash
  2. => ByteString

    Salt to use

  3. -> Maybe Blinder

    optional blinder to use

  4. -> PSSParams hash ByteString ByteString

    PSS Parameters to use

  5. -> PrivateKey

    RSA Private Key

  6. -> Digest hash

    Message digest

  7. -> Either Error ByteString
#

Sign using the PSS parameters and the salt explicitely passed as parameters.

the function ignore SaltLength from the PSS Parameters

See Blinder for what the optional blinder covers and when leaving it out is a decision rather than a default. signSafer generates one for you.

valueverifyDigest
  1. :: HashAlgorithm hash
  2. => PSSParams hash ByteString ByteString

    PSS Parameters to use to verify, this need to be identical to the parameters when signing

  3. -> PublicKey

    RSA Public Key

  4. -> Digest hash

    Digest to verify

  5. -> ByteString

    Signature

  6. -> Bool
#

Verify a signature using the PSS Parameters

Following RFC 8017, the signature is rejected unless it is exactly as long as the modulus (section 8.1.2, step 1) and its integer representative is below the modulus (RSAVP1, section 5.2.2, step 1). The public-key operation normalises any multiple of the modulus away, so without the second check s + n would verify as readily as s, and a third party could turn one valid signature into another without the private key.