This file is indexed.

/usr/share/doc/libghc-rsa-doc/html/Codec-Crypto-RSA-Pure.html is in libghc-rsa-doc 2.3.0-1build4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Codec.Crypto.RSA.Pure</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Codec-Crypto-RSA-Pure.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Codec-Crypto-RSA-Pure.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">RSA-2.3.0: Implementation of RSA, using the padding schemes of PKCS#1 v2.1.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Codec.Crypto.RSA.Pure</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Keys and key generation</a></li><li><a href="#g:2">High-level encryption and signature functions</a></li><li><a href="#g:3">Core routines for OAEP</a></li><li><a href="#g:4">Core PSS routines</a></li><li><a href="#g:5">Hashing algorithm declarations for use in RSA functions</a></li><li><a href="#g:6">Other mathematical functions that are handy for implementing</a></li><li><a href="#section.orphans">Orphan instances</a></li></ul></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:RSAError">RSAError</a><ul class="subs"><li>= <a href="#v:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></li><li>| <a href="#v:RSAKeySizeTooSmall">RSAKeySizeTooSmall</a></li><li>| <a href="#v:RSAIntegerTooLargeToPack">RSAIntegerTooLargeToPack</a></li><li>| <a href="#v:RSAMessageRepOutOfRange">RSAMessageRepOutOfRange</a></li><li>| <a href="#v:RSACipherRepOutOfRange">RSACipherRepOutOfRange</a></li><li>| <a href="#v:RSAMessageTooShort">RSAMessageTooShort</a></li><li>| <a href="#v:RSAMessageTooLong">RSAMessageTooLong</a></li><li>| <a href="#v:RSAMaskTooLong">RSAMaskTooLong</a></li><li>| <a href="#v:RSAIncorrectSigSize">RSAIncorrectSigSize</a></li><li>| <a href="#v:RSAIncorrectMsgSize">RSAIncorrectMsgSize</a></li><li>| <a href="#v:RSADecryptionError">RSADecryptionError</a></li><li>| <a href="#v:RSAGenError">RSAGenError</a> <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:GenError">GenError</a></li></ul></li><li class="src short"><span class="keyword">data</span> <a href="#t:HashInfo">HashInfo</a> = <a href="#v:HashInfo">HashInfo</a> {<ul class="subs"><li><a href="#v:algorithmIdent">algorithmIdent</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li><a href="#v:hashFunction">hashFunction</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li></ul>}</li><li class="src short"><span class="keyword">data</span> <a href="#t:PrivateKey">PrivateKey</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> = <a href="#v:PrivateKey">PrivateKey</a> {<ul class="subs"><li><a href="#v:private_pub">private_pub</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></li><li><a href="#v:private_d">private_d</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li><a href="#v:private_p">private_p</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li><a href="#v:private_q">private_q</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li><a href="#v:private_dP">private_dP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li><a href="#v:private_dQ">private_dQ</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li><a href="#v:private_qinv">private_qinv</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li></ul>}</li><li class="src short"><span class="keyword">data</span> <a href="#t:PublicKey">PublicKey</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> = <a href="#v:PublicKey">PublicKey</a> {<ul class="subs"><li><a href="#v:public_size">public_size</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></li><li><a href="#v:public_n">public_n</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li><a href="#v:public_e">public_e</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li></ul>}</li><li class="src short"><a href="#v:generateKeyPair">generateKeyPair</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>, <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>, g)</li><li class="src short"><a href="#v:encrypt">encrypt</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</li><li class="src short"><a href="#v:encryptOAEP">encryptOAEP</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</li><li class="src short"><a href="#v:encryptPKCS">encryptPKCS</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</li><li class="src short"><a href="#v:decrypt">decrypt</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:decryptOAEP">decryptOAEP</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:decryptPKCS">decryptPKCS</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:sign">sign</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:verify">verify</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:MGF">MGF</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:generateMGF1">generateMGF1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a></li><li class="src short"><a href="#v:rsaes_oaep_encrypt">rsaes_oaep_encrypt</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</li><li class="src short"><a href="#v:rsaes_oaep_decrypt">rsaes_oaep_decrypt</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:rsaes_pkcs1_v1_5_encrypt">rsaes_pkcs1_v1_5_encrypt</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</li><li class="src short"><a href="#v:rsaes_pkcs1_v1_5_decrypt">rsaes_pkcs1_v1_5_decrypt</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:rsassa_pkcs1_v1_5_sign">rsassa_pkcs1_v1_5_sign</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:rsassa_pkcs1_v1_5_verify">rsassa_pkcs1_v1_5_verify</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:hashSHA1">hashSHA1</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a></li><li class="src short"><a href="#v:hashSHA224">hashSHA224</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a></li><li class="src short"><a href="#v:hashSHA256">hashSHA256</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a></li><li class="src short"><a href="#v:hashSHA384">hashSHA384</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a></li><li class="src short"><a href="#v:hashSHA512">hashSHA512</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a></li><li class="src short"><a href="#v:largeRandomPrime">largeRandomPrime</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a>, g)</li><li class="src short"><a href="#v:generatePQ">generatePQ</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a>, g)</li><li class="src short"><a href="#v:chunkify">chunkify</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int64">Int64</a> -&gt; [<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>]</li><li class="src short"><a href="#v:os2ip">os2ip</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:i2osp">i2osp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integral">Integral</a> a =&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></li><li class="src short"><a href="#v:rsa_dp">rsa_dp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:rsa_ep">rsa_ep</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:rsa_vp1">rsa_vp1</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:rsa_sp1">rsa_sp1</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:modular_inverse">modular_inverse</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:modular_exponentiation">modular_exponentiation</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></li><li class="src short"><a href="#v:randomBS">randomBS</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</li><li class="src short"><a href="#v:randomNZBS">randomNZBS</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:RSAError" class="def">RSAError</a> <a href="src/Codec-Crypto-RSA-Pure.html#RSAError" class="link">Source</a> <a href="#t:RSAError" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:RSAError" class="def">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAKeySizeTooSmall" class="def">RSAKeySizeTooSmall</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAIntegerTooLargeToPack" class="def">RSAIntegerTooLargeToPack</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAMessageRepOutOfRange" class="def">RSAMessageRepOutOfRange</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSACipherRepOutOfRange" class="def">RSACipherRepOutOfRange</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAMessageTooShort" class="def">RSAMessageTooShort</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAMessageTooLong" class="def">RSAMessageTooLong</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAMaskTooLong" class="def">RSAMaskTooLong</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAIncorrectSigSize" class="def">RSAIncorrectSigSize</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAIncorrectMsgSize" class="def">RSAIncorrectMsgSize</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSADecryptionError" class="def">RSADecryptionError</a></td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a id="v:RSAGenError" class="def">RSAGenError</a> <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:GenError">GenError</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:RSAError" class="caption collapser" onclick="toggleSection('i:RSAError')">Instances</p><div id="section.i:RSAError" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:RSAError:Eq:1" class="instance expander" onclick="toggleSection('i:id:RSAError:Eq:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a></span> <a href="src/Codec-Crypto-RSA-Pure.html#line-75" class="link">Source</a> <a href="#t:RSAError" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:RSAError:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:RSAError:Show:2" class="instance expander" onclick="toggleSection('i:id:RSAError:Show:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a></span> <a href="src/Codec-Crypto-RSA-Pure.html#line-75" class="link">Source</a> <a href="#t:RSAError" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:RSAError:Show:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:RSAError:Exception:3" class="instance expander" onclick="toggleSection('i:id:RSAError:Exception:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Exception-Base.html#t:Exception">Exception</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a></span> <a href="src/Codec-Crypto-RSA-Pure.html#line-77" class="link">Source</a> <a href="#t:RSAError" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:RSAError:Exception:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toException">toException</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Exception-Base.html#t:SomeException">SomeException</a> <a href="#v:toException" class="selflink">#</a></p><p class="src"><a href="#v:fromException">fromException</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Exception-Base.html#t:SomeException">SomeException</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="#v:fromException" class="selflink">#</a></p><p class="src"><a href="#v:displayException">displayException</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:displayException" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:HashInfo" class="def">HashInfo</a> <a href="src/Codec-Crypto-RSA-Pure.html#HashInfo" class="link">Source</a> <a href="#t:HashInfo" class="selflink">#</a></p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:HashInfo" class="def">HashInfo</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:algorithmIdent" class="def">algorithmIdent</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></dfn><div class="doc"><p>The ASN.1 DER encoding of the hash function
 identifier.</p></div></li><li><dfn class="src"><a id="v:hashFunction" class="def">hashFunction</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></dfn><div class="doc"><p>The hash function</p></div></li></ul></div></td></tr></table></div></div><h1 id="g:1">Keys and key generation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:PrivateKey" class="def">PrivateKey</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> <a href="#t:PrivateKey" class="selflink">#</a></p><div class="doc"><p>Represent a RSA private key.</p><p>Only the pub, d fields are mandatory to fill.</p><p>p, q, dP, dQ, qinv are by-product during RSA generation,
 but are useful to record here to speed up massively
 the decrypt and sign operation.</p><p>implementations can leave optional fields to 0.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:PrivateKey" class="def">PrivateKey</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:private_pub" class="def">private_pub</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></dfn><div class="doc"><p>public part of a private key (size, n and e)</p></div></li><li><dfn class="src"><a id="v:private_d" class="def">private_d</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>private exponant d</p></div></li><li><dfn class="src"><a id="v:private_p" class="def">private_p</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>p prime number</p></div></li><li><dfn class="src"><a id="v:private_q" class="def">private_q</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>q prime number</p></div></li><li><dfn class="src"><a id="v:private_dP" class="def">private_dP</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>d mod (p-1)</p></div></li><li><dfn class="src"><a id="v:private_dQ" class="def">private_dQ</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>d mod (q-1)</p></div></li><li><dfn class="src"><a id="v:private_qinv" class="def">private_qinv</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>q^(-1) mod p</p></div></li></ul></div></td></tr></table></div><div class="subs instances"><p id="control.i:PrivateKey" class="caption collapser" onclick="toggleSection('i:PrivateKey')">Instances</p><div id="section.i:PrivateKey" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PrivateKey:Eq:1" class="instance expander" onclick="toggleSection('i:id:PrivateKey:Eq:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PrivateKey:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PrivateKey:Data:2" class="instance expander" onclick="toggleSection('i:id:PrivateKey:Data:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PrivateKey:Data:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:gfoldl">gfoldl</a> :: (<span class="keyword">forall</span> d b. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; c (d -&gt; b) -&gt; d -&gt; c b) -&gt; (<span class="keyword">forall</span> g. g -&gt; c g) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; c <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:gfoldl" class="selflink">#</a></p><p class="src"><a href="#v:gunfold">gunfold</a> :: (<span class="keyword">forall</span> b r. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> b =&gt; c (b -&gt; r) -&gt; c r) -&gt; (<span class="keyword">forall</span> r. r -&gt; c r) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Constr">Constr</a> -&gt; c <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:gunfold" class="selflink">#</a></p><p class="src"><a href="#v:toConstr">toConstr</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Constr">Constr</a> <a href="#v:toConstr" class="selflink">#</a></p><p class="src"><a href="#v:dataTypeOf">dataTypeOf</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:DataType">DataType</a> <a href="#v:dataTypeOf" class="selflink">#</a></p><p class="src"><a href="#v:dataCast1">dataCast1</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a>) t =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; c (t d)) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>) <a href="#v:dataCast1" class="selflink">#</a></p><p class="src"><a href="#v:dataCast2">dataCast2</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a>) t =&gt; (<span class="keyword">forall</span> d e. (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> e) =&gt; c (t d e)) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>) <a href="#v:dataCast2" class="selflink">#</a></p><p class="src"><a href="#v:gmapT">gmapT</a> :: (<span class="keyword">forall</span> b. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> b =&gt; b -&gt; b) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:gmapT" class="selflink">#</a></p><p class="src"><a href="#v:gmapQl">gmapQl</a> :: (r -&gt; r' -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; r <a href="#v:gmapQl" class="selflink">#</a></p><p class="src"><a href="#v:gmapQr">gmapQr</a> :: (r' -&gt; r -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; r <a href="#v:gmapQr" class="selflink">#</a></p><p class="src"><a href="#v:gmapQ">gmapQ</a> :: (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; [u] <a href="#v:gmapQ" class="selflink">#</a></p><p class="src"><a href="#v:gmapQi">gmapQi</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; u <a href="#v:gmapQi" class="selflink">#</a></p><p class="src"><a href="#v:gmapM">gmapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; m <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:gmapM" class="selflink">#</a></p><p class="src"><a href="#v:gmapMp">gmapMp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; m <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:gmapMp" class="selflink">#</a></p><p class="src"><a href="#v:gmapMo">gmapMo</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; m <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:gmapMo" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PrivateKey:Read:3" class="instance expander" onclick="toggleSection('i:id:PrivateKey:Read:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PrivateKey:Read:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:readsPrec">readsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:readsPrec" class="selflink">#</a></p><p class="src"><a href="#v:readList">readList</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> [<a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>] <a href="#v:readList" class="selflink">#</a></p><p class="src"><a href="#v:readPrec">readPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:readPrec" class="selflink">#</a></p><p class="src"><a href="#v:readListPrec">readListPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> [<a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>] <a href="#v:readListPrec" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PrivateKey:Show:4" class="instance expander" onclick="toggleSection('i:id:PrivateKey:Show:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PrivateKey:Show:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PrivateKey:ASN1Object:5" class="instance expander" onclick="toggleSection('i:id:PrivateKey:ASN1Object:5')"></span> ASN1Object <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PrivateKey:ASN1Object:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toASN1">toASN1</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; ASN1S</p><p class="src"><a href="#v:fromASN1">fromASN1</a> :: [ASN1] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> (<a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>, [ASN1])</p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a id="t:PublicKey" class="def">PublicKey</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> <a href="#t:PublicKey" class="selflink">#</a></p><div class="doc"><p>Represent a RSA public key</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a id="v:PublicKey" class="def">PublicKey</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><ul><li><dfn class="src"><a id="v:public_size" class="def">public_size</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></dfn><div class="doc"><p>size of key in bytes</p></div></li><li><dfn class="src"><a id="v:public_n" class="def">public_n</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>public p*q</p></div></li><li><dfn class="src"><a id="v:public_e" class="def">public_e</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></dfn><div class="doc"><p>public exponant e</p></div></li></ul></div></td></tr></table></div><div class="subs instances"><p id="control.i:PublicKey" class="caption collapser" onclick="toggleSection('i:PublicKey')">Instances</p><div id="section.i:PublicKey" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PublicKey:Eq:1" class="instance expander" onclick="toggleSection('i:id:PublicKey:Eq:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PublicKey:Eq:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:-61--61-">(==)</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-61--61-" class="selflink">#</a></p><p class="src"><a href="#v:-47--61-">(/=)</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="#v:-47--61-" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PublicKey:Data:2" class="instance expander" onclick="toggleSection('i:id:PublicKey:Data:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PublicKey:Data:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:gfoldl">gfoldl</a> :: (<span class="keyword">forall</span> d b. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; c (d -&gt; b) -&gt; d -&gt; c b) -&gt; (<span class="keyword">forall</span> g. g -&gt; c g) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; c <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:gfoldl" class="selflink">#</a></p><p class="src"><a href="#v:gunfold">gunfold</a> :: (<span class="keyword">forall</span> b r. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> b =&gt; c (b -&gt; r) -&gt; c r) -&gt; (<span class="keyword">forall</span> r. r -&gt; c r) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Constr">Constr</a> -&gt; c <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:gunfold" class="selflink">#</a></p><p class="src"><a href="#v:toConstr">toConstr</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Constr">Constr</a> <a href="#v:toConstr" class="selflink">#</a></p><p class="src"><a href="#v:dataTypeOf">dataTypeOf</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:DataType">DataType</a> <a href="#v:dataTypeOf" class="selflink">#</a></p><p class="src"><a href="#v:dataCast1">dataCast1</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a>) t =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; c (t d)) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>) <a href="#v:dataCast1" class="selflink">#</a></p><p class="src"><a href="#v:dataCast2">dataCast2</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Typeable-Internal.html#t:Typeable">Typeable</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Kind.html#t:-42-">*</a>) t =&gt; (<span class="keyword">forall</span> d e. (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> e) =&gt; c (t d e)) -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> (c <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>) <a href="#v:dataCast2" class="selflink">#</a></p><p class="src"><a href="#v:gmapT">gmapT</a> :: (<span class="keyword">forall</span> b. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> b =&gt; b -&gt; b) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:gmapT" class="selflink">#</a></p><p class="src"><a href="#v:gmapQl">gmapQl</a> :: (r -&gt; r' -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; r <a href="#v:gmapQl" class="selflink">#</a></p><p class="src"><a href="#v:gmapQr">gmapQr</a> :: (r' -&gt; r -&gt; r) -&gt; r -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; r') -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; r <a href="#v:gmapQr" class="selflink">#</a></p><p class="src"><a href="#v:gmapQ">gmapQ</a> :: (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; [u] <a href="#v:gmapQ" class="selflink">#</a></p><p class="src"><a href="#v:gmapQi">gmapQi</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; u) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; u <a href="#v:gmapQi" class="selflink">#</a></p><p class="src"><a href="#v:gmapM">gmapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; m <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:gmapM" class="selflink">#</a></p><p class="src"><a href="#v:gmapMp">gmapMp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; m <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:gmapMp" class="selflink">#</a></p><p class="src"><a href="#v:gmapMo">gmapMo</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:MonadPlus">MonadPlus</a> m =&gt; (<span class="keyword">forall</span> d. <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Data.html#t:Data">Data</a> d =&gt; d -&gt; m d) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; m <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:gmapMo" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PublicKey:Read:3" class="instance expander" onclick="toggleSection('i:id:PublicKey:Read:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PublicKey:Read:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:readsPrec">readsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:readsPrec" class="selflink">#</a></p><p class="src"><a href="#v:readList">readList</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadP.html#t:ReadS">ReadS</a> [<a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>] <a href="#v:readList" class="selflink">#</a></p><p class="src"><a href="#v:readPrec">readPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:readPrec" class="selflink">#</a></p><p class="src"><a href="#v:readListPrec">readListPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-ParserCombinators-ReadPrec.html#t:ReadPrec">ReadPrec</a> [<a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>] <a href="#v:readListPrec" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PublicKey:Show:4" class="instance expander" onclick="toggleSection('i:id:PublicKey:Show:4')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PublicKey:Show:4" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:id:PublicKey:ASN1Object:5" class="instance expander" onclick="toggleSection('i:id:PublicKey:ASN1Object:5')"></span> ASN1Object <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></span></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:id:PublicKey:ASN1Object:5" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:toASN1">toASN1</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; ASN1S</p><p class="src"><a href="#v:fromASN1">fromASN1</a> :: [ASN1] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> (<a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>, [ASN1])</p></div></div></td></tr></table></div></div></div><div class="top"><p class="src"><a id="v:generateKeyPair" class="def">generateKeyPair</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>, <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#generateKeyPair" class="link">Source</a> <a href="#v:generateKeyPair" class="selflink">#</a></p><div class="doc"><p>Randomly generate a key pair of the given modules length (in bits) to use
 in any of the following functions. Use of a good random number generator is
 of considerable importance when using this function. The input
 CryptoRandomGen should never be used again for any other purpose; either
 use the output'd generator or throw it all away.</p></div></div><h1 id="g:2">High-level encryption and signature functions</h1><div class="top"><p class="src"><a id="v:encrypt" class="def">encrypt</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#encrypt" class="link">Source</a> <a href="#v:encrypt" class="selflink">#</a></p><div class="doc"><p>Encrypt an arbitrarily-sized message given the public key and reasonable
 options. This is equivalent to calling encryptOAEP with SHA-256 as the
 hash function, MGF1(SHA-256) as the mask generation function, and no label.
 NOTE: This hash choice means that your key size must be 1024 bits or larger.</p></div></div><div class="top"><p class="src"><a id="v:encryptOAEP" class="def">encryptOAEP</a> <a href="src/Codec-Crypto-RSA-Pure.html#encryptOAEP" class="link">Source</a> <a href="#v:encryptOAEP" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; g</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">-&gt; (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)</td><td class="doc"><p>The hash function to use </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a></td><td class="doc"><p>The mask generation function to use </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>An optional label to include </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></td><td class="doc"><p>The public key to encrypt with </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The message to encrypt </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Encrypt an arbitrarily-sized message using OAEP encoding. This is the
 encouraged encoding for doing RSA encryption. Note that your key size
 must be greater than (2 * hash length + 2) * 8. (For example, the
 <code><a href="Codec-Crypto-RSA-Pure.html#v:encrypt">encrypt</a></code> convenience function uses a 256 bit / 32 byte hash function.
 Thus, its key must be greater than (2 * 32 + 2) * 8 = 528 bits long,
 and we suggest 1024 as a lower bound.)</p></div></div><div class="top"><p class="src"><a id="v:encryptPKCS" class="def">encryptPKCS</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#encryptPKCS" class="link">Source</a> <a href="#v:encryptPKCS" class="selflink">#</a></p><div class="doc"><p>Encrypt an arbitrarily-sized message using PKCS1 v1.5 encoding. This
 encoding is deprecated, and should only be used when interacting with
 legacy software that cannot be modified.</p></div></div><div class="top"><p class="src"><a id="v:decrypt" class="def">decrypt</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Codec-Crypto-RSA-Pure.html#decrypt" class="link">Source</a> <a href="#v:decrypt" class="selflink">#</a></p><div class="doc"><p>Decrypt an arbitrarily-sized message given the public key and reasonable
 options. This is equivalent to calling encryptOAEP with SHA-256 as the
 hash function, MGF1(SHA-256) as the mask generation function, and no label.</p></div></div><div class="top"><p class="src"><a id="v:decryptOAEP" class="def">decryptOAEP</a> <a href="src/Codec-Crypto-RSA-Pure.html#decryptOAEP" class="link">Source</a> <a href="#v:decryptOAEP" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)</td><td class="doc"><p>The hash function to use </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a></td><td class="doc"><p>The mask generation function to use </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>An optional label to include </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></td><td class="doc"><p>The public key to encrypt with </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The message to decrypt </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Decrypt an arbitrarily-sized message using OAEP encoding. This is the
 encouraged encoding for doing RSA encryption.</p></div></div><div class="top"><p class="src"><a id="v:decryptPKCS" class="def">decryptPKCS</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Codec-Crypto-RSA-Pure.html#decryptPKCS" class="link">Source</a> <a href="#v:decryptPKCS" class="selflink">#</a></p><div class="doc"><p>Decrypt an arbitrarily-sized message using PKCS1 v1.5 encoding. This
 encoding is deprecated, and should only be used when interacting with
 legacy software that cannot be modified.</p></div></div><div class="top"><p class="src"><a id="v:sign" class="def">sign</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Codec-Crypto-RSA-Pure.html#sign" class="link">Source</a> <a href="#v:sign" class="selflink">#</a></p><div class="doc"><p>Compute a signature for the given ByteString, using the SHA256 algorithm
 in the computation. This is currently defined as rsassa_pkcs1_v1_5_sign
 hashSHA256. If you want to use a different function, simply use the PKCS
 function, below; it will accept arbitrarily-length messages.</p></div></div><div class="top"><p class="src"><a id="v:verify" class="def">verify</a> <a href="src/Codec-Crypto-RSA-Pure.html#verify" class="link">Source</a> <a href="#v:verify" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></td><td class="doc"><p>The key of the signer </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The message </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The purported signature </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Verify a signature for the given ByteString, using the SHA25 algorithm in
 the computation. Again, if you'd like to use a different algorithm, use the
 rsassa_pkcs1_v1_5_verify function.</p></div></div><h1 id="g:3">Core routines for OAEP</h1><div class="top"><p class="src"><span class="keyword">type</span> <a id="t:MGF" class="def">MGF</a> = <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int64">Int64</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Codec-Crypto-RSA-Pure.html#MGF" class="link">Source</a> <a href="#t:MGF" class="selflink">#</a></p><div class="doc"><p>A 'mask generation function'. The input is a bytestring, and the output
 is a hash of the given length. Unless you know what you're doing, you
 should probably use a MGF1 formulation created with generate_MGF1.</p></div></div><div class="top"><p class="src"><a id="v:generateMGF1" class="def">generateMGF1</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>) -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a> <a href="src/Codec-Crypto-RSA-Pure.html#generateMGF1" class="link">Source</a> <a href="#v:generateMGF1" class="selflink">#</a></p><div class="doc"><p>Generate a mask generation function for the rsaes_oaep_*. As
 suggested by the name, the generated function is an instance of the MGF1
 function. The arguments are the underlying hash function to use and the
 size of a hash in bytes.</p><p>The bytestring passed to the generated function cannot be longer than
 2^32 * hLen, where hLen is the passed length of the hash.</p></div></div><div class="top"><p class="src"><a id="v:rsaes_oaep_encrypt" class="def">rsaes_oaep_encrypt</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsaes_oaep_encrypt" class="link">Source</a> <a href="#v:rsaes_oaep_encrypt" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">=&gt; g</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">-&gt; (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)</td><td class="doc"><p>The hash function to use</p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a></td><td class="doc"><p>An appropriate mask genereation function </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></td><td class="doc"><p>The recipient's public key </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>A label to associate with the message
                                    (feel free to use BS.empty) </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The message to encrypt </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g)</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>The generalized implementation of RSAES-OAEP-ENCRYPT. Using the default
 instantiontion of this, provided by the <code><a href="Codec-Crypto-RSA-Pure.html#v:encrypt">encrypt</a></code> function, is a pretty
 good plan if this makes no sense to you, as it is instantiated with
 reasonable defaults.</p><p>The message to be encrypted may not be longer then (k - 2*hLen - 2),
 where k is the length of the RSA modulus in bytes and hLen is the length
 of a hash in bytes. Passing in a larger message will generate an error,
 represented by the Left constructor. Note that this means that OAEP
 encryption cannot be used with keys smaller than 512 bits.</p><p>I have not put in a check for the length of the label, because I don't
 expect you to use more than 2^32 bytes. So don't make me regret that, eh?</p></div></div><div class="top"><p class="src"><a id="v:rsaes_oaep_decrypt" class="def">rsaes_oaep_decrypt</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsaes_oaep_decrypt" class="link">Source</a> <a href="#v:rsaes_oaep_decrypt" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>)</td><td class="doc"><p>The hash function to use</p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:MGF">MGF</a></td><td class="doc"><p>A mask generation function </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></td><td class="doc"><p>The private key to use </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>An optional label whose
                                     association with the message
                                     should be verified. </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The ciphertext to decrypt </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>The generalized implementation of RSAES-OAEP-DECRYPT. Again, <code><a href="Codec-Crypto-RSA-Pure.html#v:decrypt">decrypt</a></code>
 initializes this with a pretty good set of defaults if you don't understand
 what all of the arguments involve.</p><p>The ciphertext message passed to this function must be k bytes long, where
 k is the size of the modulus in bytes. If it is not, this function will
 generate an error, represented by the Left constructor.</p><p>Futher, k (the length of the ciphertext in bytes) must be greater than or
 equal to (2 * hLen + 2), where hLen is the length of the output of the
 hash function in bytes. If this equation does not hold, a (different)
 error will be generated.</p><p>Finally, there are any number of internal situations that may generate
 an error indicating that decryption failed.</p></div></div><h1 id="g:4">Core PSS routines</h1><div class="doc"><p>|RSASSA-PSS-Sign, RSASSA-PSS-Verify, and the related functions are not
 included because they are covered by U.S. Patent 7036014, and it's not clear
 what the restrictions on implementation are. Sorry.</p></div><div class="top"><p class="src"><a id="v:rsaes_pkcs1_v1_5_encrypt" class="def">rsaes_pkcs1_v1_5_encrypt</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#rsaes_pkcs1_v1_5_encrypt" class="link">Source</a> <a href="#v:rsaes_pkcs1_v1_5_encrypt" class="selflink">#</a></p><div class="doc"><p>Implements RSAES-PKCS1-v1.5-Encrypt, for completeness and backward
 compatibility. Also because I've already written everything else, so why not?</p><p>This encryption / padding mechanism has several known attacks, which are
 described in the literature. So unless you absolutely need to use this
 for some historical reason, you should avoid it.</p><p>The message to be encrypted must be less then or equal to (k - 11) bytes
 long, where k is the length of the key modulus in bytes.</p><p>Because this function uses an unknown amount of randomly-generated data,
 it takes an instance of RandomGen rather than taking a random number as
 input, and returns the resultant generator as output. You should take care
 that you (a) do not reuse the input generator, thus losing important
 randomness, and (b) choose a decent instance of RandomGen for passing to
 this function.</p></div></div><div class="top"><p class="src"><a id="v:rsaes_pkcs1_v1_5_decrypt" class="def">rsaes_pkcs1_v1_5_decrypt</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsaes_pkcs1_v1_5_decrypt" class="link">Source</a> <a href="#v:rsaes_pkcs1_v1_5_decrypt" class="selflink">#</a></p><div class="doc"><p>Implements RSAES-PKCS1-v1.5-Decrypt, for completeness and possible backward
 compatibility. Please see the notes for rsaes_pkcs_v1_5_encrypt regarding
 use of this function in new applications without backwards compatibility
 requirements.</p><p>The ciphertext message passed to this function must be of length k, where
 k is the length of the key modulus in bytes.</p></div></div><div class="top"><p class="src"><a id="v:rsassa_pkcs1_v1_5_sign" class="def">rsassa_pkcs1_v1_5_sign</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsassa_pkcs1_v1_5_sign" class="link">Source</a> <a href="#v:rsassa_pkcs1_v1_5_sign" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a></td><td class="doc"><p>The hash function to use </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></td><td class="doc"><p>The private key to sign with </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The message to sign </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The signature</p></td></tr></table></div><div class="doc"><p>Generate a signature for the given message using the given private key,
 using the RSASSA-PKCS1-v1.5-Sign algorithm. Note that in researching the
 requirements for this project, several independent sources suggested not
 using the same key across sign<em>validate and encrypt</em>decrypt contexts. You've
 been warned.</p><p>The output of this function is the signature only, not the message and
 the signature.</p><p>SIZE CONSTRAINT: The size of the public key (in bytes) must be greater
 than or equal to the length of the hash identifier plus the length of
 a hash plus 1. Thus, for example, you cannot use a 256 bit RSA key with
 MD5: 32 (the size of a 256-bit RSA key in bytes) is less than 18 (the
 size of MD5's identier) + 16 (the size of an MD5 hash in bytes) + 1,
 or 35.</p><p>Thus,
   * for SHA1 and SHA256, use 512+ bit keys
   * for SHA384 and SHA512, use 1024+ bit keys</p></div></div><div class="top"><p class="src"><a id="v:rsassa_pkcs1_v1_5_verify" class="def">rsassa_pkcs1_v1_5_verify</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsassa_pkcs1_v1_5_verify" class="link">Source</a> <a href="#v:rsassa_pkcs1_v1_5_verify" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a></td><td class="doc"><p>The hash function to use </p></td></tr><tr><td class="src">-&gt; <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></td><td class="doc"><p>The public key to validate against</p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The message that was signed </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a></td><td class="doc"><p>The purported signature </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Validate a signature for the given message using the given public key. The
 signature must be exactly k bytes long, where k is the size of the RSA
 modulus IN BYTES.</p></div></div><h1 id="g:5">Hashing algorithm declarations for use in RSA functions</h1><div class="top"><p class="src"><a id="v:hashSHA1" class="def">hashSHA1</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a> <a href="src/Codec-Crypto-RSA-Pure.html#hashSHA1" class="link">Source</a> <a href="#v:hashSHA1" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:hashSHA224" class="def">hashSHA224</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a> <a href="src/Codec-Crypto-RSA-Pure.html#hashSHA224" class="link">Source</a> <a href="#v:hashSHA224" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:hashSHA256" class="def">hashSHA256</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a> <a href="src/Codec-Crypto-RSA-Pure.html#hashSHA256" class="link">Source</a> <a href="#v:hashSHA256" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:hashSHA384" class="def">hashSHA384</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a> <a href="src/Codec-Crypto-RSA-Pure.html#hashSHA384" class="link">Source</a> <a href="#v:hashSHA384" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:hashSHA512" class="def">hashSHA512</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:HashInfo">HashInfo</a> <a href="src/Codec-Crypto-RSA-Pure.html#hashSHA512" class="link">Source</a> <a href="#v:hashSHA512" class="selflink">#</a></p></div><h1 id="g:6">Other mathematical functions that are handy for implementing</h1><div class="top"><p class="src"><a id="v:largeRandomPrime" class="def">largeRandomPrime</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#largeRandomPrime" class="link">Source</a> <a href="#v:largeRandomPrime" class="selflink">#</a></p><div class="doc"><p>Generate a large random prime of a given length in bytes.</p></div></div><div class="top"><p class="src"><a id="v:generatePQ" class="def">generatePQ</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a>, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#generatePQ" class="link">Source</a> <a href="#v:generatePQ" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:chunkify" class="def">chunkify</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int64">Int64</a> -&gt; [<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>] <a href="src/Codec-Crypto-RSA-Pure.html#chunkify" class="link">Source</a> <a href="#v:chunkify" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:os2ip" class="def">os2ip</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> <a href="src/Codec-Crypto-RSA-Pure.html#os2ip" class="link">Source</a> <a href="#v:os2ip" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:i2osp" class="def">i2osp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integral">Integral</a> a =&gt; a -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a> <a href="src/Codec-Crypto-RSA-Pure.html#i2osp" class="link">Source</a> <a href="#v:i2osp" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:rsa_dp" class="def">rsa_dp</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsa_dp" class="link">Source</a> <a href="#v:rsa_dp" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:rsa_ep" class="def">rsa_ep</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsa_ep" class="link">Source</a> <a href="#v:rsa_ep" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:rsa_vp1" class="def">rsa_vp1</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsa_vp1" class="link">Source</a> <a href="#v:rsa_vp1" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:rsa_sp1" class="def">rsa_sp1</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> <a href="src/Codec-Crypto-RSA-Pure.html#rsa_sp1" class="link">Source</a> <a href="#v:rsa_sp1" class="selflink">#</a></p></div><div class="top"><p class="src"><a id="v:modular_inverse" class="def">modular_inverse</a> <a href="src/Codec-Crypto-RSA-Pure.html#modular_inverse" class="link">Source</a> <a href="#v:modular_inverse" class="selflink">#</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></td><td class="doc"><p>e </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></td><td class="doc"><p>phi </p></td></tr><tr><td class="src">-&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a></td><td class="doc empty">&nbsp;</td></tr></table></div><div class="doc"><p>Compute the modular inverse (d = e^-1 mod phi) via the extended euclidean
 algorithm.</p></div></div><div class="top"><p class="src"><a id="v:modular_exponentiation" class="def">modular_exponentiation</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Integer">Integer</a> <a href="src/Codec-Crypto-RSA-Pure.html#modular_exponentiation" class="link">Source</a> <a href="#v:modular_exponentiation" class="selflink">#</a></p><div class="doc"><p>Computes a^b mod c using a moderately good algorithm.</p></div></div><div class="top"><p class="src"><a id="v:randomBS" class="def">randomBS</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#randomBS" class="link">Source</a> <a href="#v:randomBS" class="selflink">#</a></p><div class="doc"><p>Generate a random ByteString of the given length</p></div></div><div class="top"><p class="src"><a id="v:randomNZBS" class="def">randomNZBS</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:CryptoRandomGen">CryptoRandomGen</a> g =&gt; g -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> <a href="Codec-Crypto-RSA-Pure.html#t:RSAError">RSAError</a> (<a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.8.1/Data-ByteString-Lazy.html#t:ByteString">ByteString</a>, g) <a href="src/Codec-Crypto-RSA-Pure.html#randomNZBS" class="link">Source</a> <a href="#v:randomNZBS" class="selflink">#</a></p><div class="doc"><p>Create a random bytestring of non-zero bytes of the given length.</p></div></div><h1>Orphan instances</h1><div id="section.orphans" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Show:Show:1" class="instance expander" onclick="toggleSection('i:o:ic:Show:Show:1')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:SystemRandom">SystemRandom</a></span> <a href="src/Codec-Crypto-RSA-Pure.html#line-85" class="link">Source</a> <a href="#v:-36-fShowSystemRandom" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Show:Show:1" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:showsPrec">showsPrec</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:SystemRandom">SystemRandom</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showsPrec" class="selflink">#</a></p><p class="src"><a href="#v:show">show</a> :: <a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:SystemRandom">SystemRandom</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> <a href="#v:show" class="selflink">#</a></p><p class="src"><a href="#v:showList">showList</a> :: [<a href="file:///usr/share/doc/libghc-crypto-api-doc/html/Crypto-Random.html#t:SystemRandom">SystemRandom</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:ShowS">ShowS</a> <a href="#v:showList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Binary:Binary:2" class="instance expander" onclick="toggleSection('i:o:ic:Binary:Binary:2')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary.html#t:Binary">Binary</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a></span> <a href="src/Codec-Crypto-RSA-Pure.html#line-97" class="link">Source</a> <a href="#v:-36-fBinaryPublicKey" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Binary:Binary:2" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:put">put</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Put.html#t:Put">Put</a> <a href="#v:put" class="selflink">#</a></p><p class="src"><a href="#v:get">get</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Get-Internal.html#t:Get">Get</a> <a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a> <a href="#v:get" class="selflink">#</a></p><p class="src"><a href="#v:putList">putList</a> :: [<a href="Codec-Crypto-RSA-Pure.html#t:PublicKey">PublicKey</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Put.html#t:Put">Put</a> <a href="#v:putList" class="selflink">#</a></p></div></div></td></tr><tr><td class="src clearfix"><span class="inst-left"><span id="control.i:o:ic:Binary:Binary:3" class="instance expander" onclick="toggleSection('i:o:ic:Binary:Binary:3')"></span> <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary.html#t:Binary">Binary</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a></span> <a href="src/Codec-Crypto-RSA-Pure.html#line-106" class="link">Source</a> <a href="#v:-36-fBinaryPrivateKey" class="selflink">#</a></td><td class="doc empty">&nbsp;</td></tr><tr><td colspan="2"><div id="section.i:o:ic:Binary:Binary:3" class="inst-details hide"><div class="subs methods"><p class="caption">Methods</p><p class="src"><a href="#v:put">put</a> :: <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Put.html#t:Put">Put</a> <a href="#v:put" class="selflink">#</a></p><p class="src"><a href="#v:get">get</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Get-Internal.html#t:Get">Get</a> <a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a> <a href="#v:get" class="selflink">#</a></p><p class="src"><a href="#v:putList">putList</a> :: [<a href="Codec-Crypto-RSA-Pure.html#t:PrivateKey">PrivateKey</a>] -&gt; <a href="file:///usr/share/doc/ghc-doc/html/libraries/binary-0.8.3.0/Data-Binary-Put.html#t:Put">Put</a> <a href="#v:putList" class="selflink">#</a></p></div></div></td></tr></table></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>