mPA      !"#$%&'()*+,-./0123456789 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c defghijkl m n o p q r s t uvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@  Safe-InferedABCABCABC Safe-InferedDEFGDEFGDEFG Safe-Infered HIJKLMNOP HIJKLMNOP HIJKLMNOP Safe-InferedQRSTUVQRSTUVQUTSRV Safe-Infered str% lazilly encodes a stream of data to  Base64. The string doesn'*t have to be finite. Note that the string ( must not contain any letters which aren't in the range of U+0000 -  U+00FF.  bs- strictly encodes a chunk of data to Base64.  lbs% lazilly encodes a stream of data to  Base64. The string doesn't have to be finite.  str' lazilly decodes a stream of data from  Base64. The string doesn't have to be finite.  bs' strictly decodes a chunk of data from  Base64.  lbs' lazilly decodes a stream of data from  Base64. The string doesn't have to be finite.  Safe-InferedW#Convert an integer to a hex string X#Convert a hex string to an integer YZ[\]WX^YZ[\]WX^YZ[\]WX^ Safe-Infered Digest5 is an opaque object that represents an algorithm of  message digest. Cipher5 is an opaque object that represents an algorithm of  symmetric cipher. *_`abcdefghi jklmn opqrstuvwxyz{|}~*_`abcdefghi jklmn opqrstuvwxyz{|}~!_`abcdefghi jklmn opqrstuvwxyz{|}~ Safe-Infered  CryptoMode represents instruction to  and such like.  name& returns a symmetric cipher algorithm  whose name is name,. If no algorithms are found, the result is  Nothing. , returns a list of name of symmetric cipher  algorithms. FEncrypt a lazy bytestring in a strict manner. Does not leak the keys. 4 lazilly encrypts or decrypts a stream of data. The  input string doesn'!t necessarily have to be finite. 0 strictly encrypts or decrypts a chunk of data. 4 lazilly encrypts or decrypts a stream of data. The  input string doesn'!t necessarily have to be finite. Cipher Key IV Encrypt/Decrypt Input algorithm to use symmetric key IV  operation An input string to encrypt/decrypt. Note 0 that the string must not contain any letters  which aren't in the range of U+0000 -  U+00FF. the result string algorithm to use symmetric key IV  operation input string to encrypt/decrypt the result string algorithm to use symmetric key IV  operation input string to encrypt/decrypt the result string      Safe-Infered name* returns a message digest algorithm whose  name is name,. If no algorithms are found, the result is  Nothing. * returns a list of name of message digest  algorithms. + digests a stream of data. The string must # not contain any letters which aren't in the range of U+0000 -  U+00FF.  digests a chunk of data. Same as  but returns  instead.  digests a stream of data. HPerform a private key signing using the HMAC template with a given hash BCalculate a PKCS5-PBKDF2 SHA1-HMAC suitable for password hashing. 1the hash function to use in the HMAC calculation  the HMAC key the data to be signed resulting HMAC  password salt  iterations destination key length destination key   Safe-Infered =Construct a new context which holds the key schedule and IV. !HEncrypt some number of blocks using CBC. This is an IO function because ( the context is destructivly updated. "DEncrypt some number of bytes using CTR mode. This is an IO function 0 because the context is destructivly updated.  *For CTR mode, this must always be Encrypt Key: 128, 192 or 256 bits long IV: 16 bytes long !context 1input, must be multiple of block size (16 bytes) "context input, any number of bytes  !" !" !" Safe-InferedBIO is a  ForeignPtr> to an opaque BIO object. They are created by newXXX actions. Computation of  a b connects b behind a.  Example:  do b64 <- newBase64 True  mem <- newMem  bioPush b64 mem  > -- Encode some text in Base64 and write the result to the  -- memory buffer. ! bioWrite b64 "Hello, world!"  bioFlush b64  $ -- Then dump the memory buffer.  bioRead mem >>= putStrLn a  b is an alias to  a b. a  b is an alias to  b a.  [bio1, bio2, ..] connects many BIOs at once.  bio3 normally writes out any internally buffered data, C in some cases it is used to signal EOF and that no more data will  be written.  bio/ typically resets a BIO to some initial state.  bio returns 1 if bio has read EOF, the precise 2 meaning of EOF varies according to the BIO type.  bio lazily reads all data in bio.  bio len attempts to read len bytes from bio, C then return a ByteString. The actual length of result may be less  than len.  bio lazily reads all data in bio, then return a  LazyByteString.  bio len, normally attempts to read one line of data  from bio of maximum length len. There are exceptions to this  however, for example $ on a digest BIO will calculate and 2 return the digest and other BIOs may not support  at all.  does the same as  but returns ByteString.  does the same as  but returns  LazyByteString.  bio str lazily writes entire str to bio. The  string doesn'!t necessarily have to be finite.  bio bs writes bs to bio.  bio lbs lazily writes entire lbs to bio. The  string doesn'!t necessarily have to be finite.  noNL/ creates a Base64 BIO filter. This is a filter E bio that base64 encodes any data written through it and decodes any  data read through it. If noNL; flag is True, the filter encodes the data all on one line , or expects the data to be all on one line. Base64 BIOs do not support . : on a Base64 BIO that is being written through is used to B signal that no more data is to be encoded: this is used to flush " the final block through the BIO.  mBufSize& creates a buffering BIO filter. Data D written to a buffering BIO is buffered and periodically written to A the next BIO in the chain. Data read from a buffering BIO comes ! from the next BIO in the chain. Buffering BIOs support . Calling . on a buffering BIO clears any buffered data. @Question: When I created a BIO chain like this and attempted to B read from the buf, the buffering BIO weirdly behaved: BIO_read() = returned nothing, but both BIO_eof() and BIO_should_retry() 6 returned zero. I tried to examine the source code of  crypto/bio/(bf_buff.c but it was too complicated to ? understand. Does anyone know why this happens? The version of  OpenSSL was 0.9.7l.   main = withOpenSSL $ . do mem <- newConstMem "Hello, world!" $ buf <- newBuffer Nothing  mem ==> buf  < bioRead buf >>= putStrLn -- This fails, but why? 5I am being depressed for this unaccountable failure.  creates a memory BIO sink/source. Any data written to D a memory BIO can be recalled by reading from it. Unless the memory A BIO is read only any data read from it is deleted from the BIO. Memory BIOs support . Calling / on a read write memory BIO clears any data in B it. On a read only BIO it restores the BIO to its original state + and the read only data can be read again. # is true if no data is in the BIO. BEvery read from a read write memory BIO will remove the data just C read with an internal copy operation, if a BIO contains a lots of ? data and it is read in small chunks the operation can be very E slow. The use of a read only memory BIO avoids this problem. If the 5 BIO must be read write then adding a buffering BIO () to & the chain will speed up the process.  str( creates a read-only memory BIO source.  bs is like  but takes a ByteString.  lbs is like  but takes a  LazyByteString.  creates a null BIO sink/source. Data written to / the null sink is discarded, reads return EOF. @A null sink is useful if, for example, an application wishes to C digest some data by writing through a digest bio but not send the C digested data anywhere. Since a BIO chain must normally include a  source/;sink BIO this can be achieved by adding a null sink BIO to  the end of the chain. Explicit buffer size (Just n ) or the  default size (Nothing).  Safe-Infered#FReturn a bytestring consisting of the given number of strongly random  bytes $DReturn a bytestring consisting of the given number of pseudo random  bytes % Add data to the entropy pool. It'$s safe to add sensitive information L (e.g. user passwords etc) to the pool. Also, adding data with an entropy  of 0 can never hurt. #the number of bytes requested $the number of bytes requested %$random data to be added to the pool 4the number of bits of entropy in the first argument #$%#$%#$% Safe-Infered''0 is an opaque object representing a big number. (( f allocates a ' and computes f . Then it  frees the '. +Convert a BIGNUM to an Integer ,EThis is a GHC specific, fast conversion between Integers and OpenSSL * bignums. It returns a malloced BigNum. -- n f converts n to a ' and computes f . Then it  frees the '. .This is an alias to +. /This is an alias to ,. 09Convert an Integer to an MPI. See bnToMPI for the format 19Convert an MPI to an Integer. See bnToMPI for the format 22 a p m computes a to the p-th power modulo m. 3/Return a strongly random number in the range 0 <= x < n where the given ! filter function returns true. 4&Return a random number in the range 0 <= x < n where the given ! filter function returns true. 5/Return a strongly random number in the range 0 <= x < n 6/Return a strongly random number in the range 0 < x < n 7&Return a random number in the range 0 <= x < n 8&Return a random number in the range 0 < x < n &'()*+,-./0123a filter function one plus the upper limit 4a filter function one plus the upper limit 5678&'()*+,-./012345678'&(-/*).,+012345768&'()*+,-./012345678  Safe-Infered99 a is either D or C. :Return the length of key. ;+Return the public prime number of the key. <$Return the public 160-bit subprime,  q | p - 1 of the key. =4Return the public generator of subgroup of the key. >Return the public key y = g^x. CLThe type of a DSA keypair, includes parameters p, q, g, public and private. DFThe type of a DSA public key, includes parameters p, q, g and public. EIGenerate DSA parameters (*not* a key, but required for a key). This is a L compute intensive operation. See FIPS 186-2, app 2. This agrees with the * test vectors given in FIP 186-2, app 5 F3Generate a new DSA keypair, given valid parameters GReturn the private key x. H<Convert a DSAPubKey object to a tuple of its members in the  order p, q, g, and public. I=Convert a DSAKeyPair object to a tuple of its members in the & order p, q, g, public and private. J7Convert a tuple of members (in the same format as from  H) into a DSAPubKey object K7Convert a tuple of members (in the same format as from  H) into a DSAPubKey object LKA utility function to generate both the parameters and the key pair at the E same time. Saves serialising and deserialising the parameters too MJSign pre-digested data. The DSA specs call for SHA1 to be used so, if you L use anything else, YMMV. Returns a pair of Integers which, together, are  the signature N,Verify pre-digested data given a signature. 9:;<=>?@ABCDE/The number of bits in the generated prime: 512 <= x <= 1024 +optional seed, its length must be 20 bytes ,(iteration count, generator count, p, q, g) Fp q g GHIJKL/The number of bits in the generated prime: 512 <= x <= 1024 +optional seed, its length must be 20 bytes MN9:;<=>?@ABCDEFGHIJKLMN9:;<=>?@ADCBEFLMNGHIJK9:;<=>?@ABCDEFGHIJKLMN  Safe-InferedOO' represents a callback function to get . informed the progress of RSA key generation.   callback 0 i is called after generating the i-th potential  prime number. 1 While the number is being tested for primality,  callback 1 j is  called after the j-th iteration (j = 0, 1, ...).  When the n0-th randomly generated prime is rejected as not  suitable for the key,  callback 2 n is called.  When a random p has been found with p-1 relatively prime to  e, it is called as  callback 3 0. ( The process is then repeated for prime q with  callback 3 1. PP a is either Y or X. QQ key returns the length of key. RR key( returns the public modulus of the key. SS key) returns the public exponent of the key. XX2 is an opaque object that represents RSA keypair. YY5 is an opaque object that represents RSA public key. Z7Make a copy of the public parameters of the given key. \\ generates an RSA keypair. ]A simplified alternative to \ ^^ privKey* returns the private exponent of the key. __ privkey! returns the secret prime factor p of the key. `` privkey! returns the secret prime factor q of the key. aa privkey returns  d mod (p-1) of the key. bb privkey returns  d mod (q-1) of the key. cc privkey returns  q^-1 mod p of the key. OPQRSTUVWXYZ[\)The number of bits of the public modulus # (i.e. key size). Key sizes with n <  1024 should be considered insecure. "The public exponent. It is an odd % number, typically 3, 17 or 65537. A callback function. The generated keypair. ])The number of bits of the public modulus # (i.e. key size). Key sizes with n <  1024 should be considered insecure. "The public exponent. It is an odd % number, typically 3, 17 or 65537. The generated keypair. ^_`abcOPQRSTUVWXYZ[\]^_`abcPQRSTUVYXWO\]^_`abcZ[OPQRSTUVWXYZ[\]^_`abc Safe-Inferedd?This is an opaque type to hold an arbitrary keypair in it. The 2 actual key type can be safelly type-casted using h. eBThis is an opaque type to hold an arbitrary public key in it. The 2 actual key type can be safelly type-casted using k. fCInstances of this class has both of public and private portions of  a keypair. g0Wrap an arbitrary keypair into polymorphic type d. hCast from the polymorphic type d to the concrete  type. Return  if failed. i9Instances of this class has at least public portion of a 8 keypair. They might or might not have the private key. j3Wrap an arbitrary public key into polymorphic type  e. kCast from the polymorphic type e to the concrete  type. Return  if failed. defghijk defghijk ijkfgheddefghijk  Safe-Inferedll5 lazilly decrypts a stream of data. The input string  doesn'!t necessarily have to be finite. mm decrypts a chunk of data. nn5 lazilly decrypts a stream of data. The input string  doesn'!t necessarily have to be finite. l"symmetric cipher algorithm to use 4encrypted symmetric key to decrypt the input string IV )private key to decrypt the symmetric key input string to decrypt decrypted string m"symmetric cipher algorithm to use 4encrypted symmetric key to decrypt the input string IV )private key to decrypt the symmetric key input string to decrypt decrypted string n"symmetric cipher algorithm to use 4encrypted symmetric key to decrypt the input string IV )private key to decrypt the symmetric key input string to decrypt decrypted string lmnlmnlmn  Safe-Inferedoo5 lazilly encrypts a stream of data. The input string  doesn'!t necessarily have to be finite. pp$ strictly encrypts a chunk of data. qq5 lazilly encrypts a stream of data. The input string  doesn'!t necessarily have to be finite. o"symmetric cipher algorithm to use #A list of public keys to encrypt a * symmetric key. At least one public key - must be supplied. If two or more keys are - given, the symmetric key are encrypted by ' each public keys so that any of the * corresponding private keys can decrypt  the message. input string to encrypt (encrypted string, list of  encrypted asymmetric keys,  IV) p"symmetric cipher algorithm to use !list of public keys to encrypt a  symmetric key input string to encrypt (encrypted string,  list of encrypted  asymmetric keys, IV) q"symmetric cipher algorithm to use !list of public keys to encrypt a  symmetric key input string to encrypt  (encrypted  string, list of  encrypted  asymmetric keys,  IV) opqopqopq  Safe-Inferedrr9 generates a signature from a stream of data. The string ( must not contain any letters which aren't in the range of U+0000 -  U+00FF. ss- generates a signature from a chunk of data. tt. generates a signature from a stream of data. r message digest algorithm to use 'private key to sign the message digest  input string the result signature s message digest algorithm to use 'private key to sign the message digest  input string the result signature t message digest algorithm to use 'private key to sign the message digest  input string the result signature rstrstrst Safe-Infereduu& represents a result of verification. xx7 verifies a signature and a stream of data. The string ( must not contain any letters which aren't in the range of U+0000 -  U+00FF. yy+ verifies a signature and a chunk of data. zz+ verifies a signature of a stream of data. uvwx message digest algorithm to use message signature #public key to verify the signature input string to verify the result of verification y message digest algorithm to use message signature #public key to verify the signature input string to verify the result of verification z message digest algorithm to use message signature #public key to verify the signature input string to verify the result of verification uvwxyzuwvxyzuwvxyz Safe-Infered~~ gen n generates n-bit long DH parameters. $Get DH parameters length (in bits). 'Check that DH parameters are coherent. IThe first step of a key exchange. Public and private keys are generated. "Get parameters of a key exchange. Get the public key. ,Compute the shared key using the other party's public key. {|}~ {|}~ {}|~{}|~ Safe-Infered    Safe-Infered Safe-Infered8 is an opaque object that represents X.509 certificate. 0 creates an empty certificate. You must set the * following properties to and sign it (see ) to actually  use the certificate. Version See .  Serial number See .  Issuer name See .  Subject name See . Validity See  and .  Public Key See .  cert1 cert2 compares two certificates. 1 signs a certificate with an issuer private key. 4 verifies a signature of certificate with an issuer  public key.  cert. translates a certificate into human-readable  format.  cert/ returns the version number of certificate. It 9 seems the number is 0-origin: version 2 means X.509 v3.  cert ver, updates the version number of certificate.  cert+ returns the serial number of certificate.  cert num updates the serial number of  certificate. ) returns the issuer name of certificate.  cert name updates the issuer name of E certificate. Keys of each parts may be of either long form or short  form. See .  cert wantLongName returns the subject name of  certificate. See .  cert name updates the subject name of  certificate. See .  cert. returns the time when the certificate begins  to be valid.  cert utc' updates the time when the certificate  begins to be valid.  cert' returns the time when the certificate  expires.  cert utc' updates the time when the certificate  expires.  cert* returns the public key of the subject of  certificate.  cert pubkey' updates the public key of the subject  of certificate.  cert* returns every subject email addresses in  the certificate. The certificate to be signed. The private key to sign with. A hashing algorithm to use. If Nothing + the most suitable algorithm for the key  is automatically used.  The certificate to be verified. The public key to verify with. The certificate to examine. True$ if you want the keys of each parts  to be of long form (e.g. " commonName"),  or False if you don't (e.g. "CN"). Pairs of key and value,  for example [("C",  "JP"), ("ST",  " Some-State"), ...].  Safe-Infered ) is an opaque object that represents PKCS#10  certificate request. 4 creates an empty certificate request. You must set . the following properties to and sign it (see ) to ' actually use the certificate request. Version See .  Subject Name See .  Public Key See . 4 signs a certificate request with a subject private  key. 2 verifies a signature of certificate request with  a subject public key.  req' translates a certificate request into  human-readable format.  req+ returns the version number of certificate  request.  req ver+ updates the version number of certificate  request.  req wantLongName returns the subject name of  certificate request. See   of   OpenSSL.X509.  req name updates the subject name of  certificate request. See ! of   OpenSSL.X509.  req* returns the public key of the subject of  certificate request.  req* updates the public key of the subject of  certificate request.  req cert$ creates an empty X.509 certificate E and copies as much data from the request as possible. The resulting  certificate doesn'$t have the following data and it isn' t signed so * you must fill them and sign it yourself.  Serial number % Validity (Not Before and Not After)  Example:  import Data.Time.Clock  D genCert :: X509 -> EvpPKey -> Integer -> Int -> X509Req -> IO X509 & genCert caCert caKey serial days req - = do cert <- makeX509FromReq req caCert ! now <- getCurrentTime & setSerialNumber cert serial 2 setNotBefore cert $ addUTCTime (-1) now C setNotAfter cert $ addUTCTime (days * 24 * 60 * 60) now & signX509 cert caKey Nothing  return cert The request to be signed. The private key to sign with. A hashing algorithm to use. If  Nothing the most suitable algorithm & for the key is automatically used. The request to be verified. The public key to verify with.  Safe-Infered' represents a revoked certificate in a ? list. Each certificates are supposed to be distinguishable by A issuer name and serial number, so it is sufficient to have only  serial number on each entries. < is an opaque object that represents Certificate Revocation  List. 4 creates an empty revocation list. You must set the * following properties to and sign it (see ) to actually use E the revocation list. If you have any certificates to be listed, you  must of course add them (see ) before signing the list. Version See .  Last Update See .  Next Update See .  Issuer Name See . 5 signs a revocation list with an issuer private key. 1 verifies a signature of revocation list with an  issuer public key. 2 translates a revocation list into human-readable  format.  crl0 returns the version number of revocation list.  crl ver* updates the version number of revocation  list.  crl+ returns the time when the revocation list  has last been updated.  crl utc& updates the time when the revocation  list has last been updated.  crl+ returns the time when the revocation list  will next be updated.  crl utc& updates the time when the revocation  list will next be updated.  crl wantLongName returns the issuer name of  revocation list. See " of   OpenSSL.X509.  crl name' updates the issuer name of revocation  list. See # of  OpenSSL.X509.  crl+ returns the list of revoked certificates.  crl revoked' add the certificate to the revocation  list.  crl serial( looks up the corresponding revocation.  crl0 sorts the certificates in the revocation list. "The revocation list to be signed. The private key to sign with. A hashing algorithm to use. If Nothing + the most suitable algorithm for the key  is automatically used.  Safe-Infered+ is an opaque object that represents X.509 D certificate store. The certificate store is usually used for chain  verification. + creates an empty X.509 certificate store.  store cert adds a certificate to store.  store crl" adds a revocation list to store.  Safe-Infered  represents a result of PKCS#7  verification. See . Nothing if the PKCS#7  signature was a detached  signature, and  Just content  if it wasn't. 4 is a set of flags that are used in many operations  related to PKCS#7.  represents an abstract PKCS#7 structure. The concrete A type of structure is hidden in the object: such polymorphism isn't E very haskellish but please get it out of your mind since OpenSSL is  written in C.  creates a PKCS#7 signedData structure.  verifies a PKCS#7 signedData structure.  creates a PKCS#7 envelopedData structure.  decrypts content from PKCS#7 envelopedData  structure.  writes PKCS#7 structure to S/MIME message.  parses S/MIME message. certificate to sign with corresponding private key (optional additional set of certificates  to include in the PKCS#7 structure (for ' example any intermediate CAs in the  chain) data to be signed An optional set of flags:  Many S/ MIME clients ( expect the signed content to include  valid MIME headers. If the  % flag is set MIME headers for type  "text/plain" are prepended to the  data.  If  is  set the signer's certificate will not be  included in the PKCS#7 structure, the  signer's certificate must still be * supplied in the parameter though. This + can reduce the size of the signature if  the signer's certificate can be obtained , by other means: for example a previously  signed message.  The data being signed  is included in the PKCS# 7 structure,  unless  is set in which ( case it is ommited. This is used for  PKCS# 7 detached signatures which are  used in S/MIME plaintext signed message  for example.  Normally the supplied # content is translated into MIME ( canonical format (as required by the  S/MIME specifications) but if   is set no translation ) occurs. This option should be uesd if ) the supplied data is in binary format * otherwise the translation will corrupt  it.   The signedData " structure includes several PKCS#7 ) authenticatedAttributes including the  signing time, the PKCS#7 content type + and the supported list of ciphers in an # SMIMECapabilities attribute. If   is set then no , authenticatedAttributes will be used. If ( Pkcs7NoSmimeCap is set then just the " SMIMECapabilities are omitted. A PKCS#7 structure to verify.  Set of certificates in which to  search for the signer's  certificate.  Trusted certificate store (used  for chain verification). "Signed data if the content is not  present in the PKCS# 7 structure  (that is it is detached). An optional set of flags:  If   is set the & certificates in the message itself & are not searched when locating the  signer's certificate. This means % that all the signers certificates " must be in the second argument  ([]).  If the  % flag is set MIME headers for type  "text/plain" are deleted from & the content. If the content is not  of type "text/plain" then an  error is returned.  If   is set the  signer's certificates are not  chain verified.  If   is set then the certificates $ contained in the message are not % used as untrusted CAs. This means & that the whole verify chain (apart  from the signer's certificate) $ must be contained in the trusted  store.  If  % is set then the signatures on the  data are not checked. "A list of recipient certificates. The content to be encrypted. The symmetric cipher to use. An optional set of flags:  If the  flag  is set MIME headers for type  "text/plain" are prepended to the  data.  Normally the supplied # content is translated into MIME ( canonical format (as required by the  S/MIME specifications) if   is set no translation ) occurs. This option should be used if ) the supplied data is in binary format " otherwise the translation will  corrupt it. If  is set  then  is ignored. The PKCS#7 structure to decrypt. "The private key of the recipient.  The recipient's certificate. An optional set of flags:  If the  flag  is set MIME headers for type  "text/plain" are deleted from the % content. If the content is not of  type "text/plain" then an error is  thrown. The decrypted content. A PKCS#7 structure to be written. If cleartext signing  (multipart/signed) is being used then * the signed data must be supplied here. An optional set of flags:  If  ) is set then cleartext signing will be * used, this option only makes sense for  signedData where  is  also set when  is also  called.  If the  flag  is set MIME headers for type  "text/plain" are added to the % content, this only makes sense if   is also set.  The result S/MIME message. The message to be read. (The result PKCS#7  structure,  Just content  if the PKCS#7 structure was  a cleartext signature and  Nothing if it wasn't.)    Safe-Infered represents format of PKCS#10 certificate  request.  The old format, whose header is " CERTIFICATE  REQUEST".  The new format, whose header is "NEW  CERTIFICATE REQUEST". & represents a way to supply password. ,FIXME: using PwTTY causes an error but I don' t know why:  ":error:0906406D:PEM routines:DEF_CALLBACK:problems getting  password" read a password from TTY get a  password  by a  callback !password in a static bytestring. password in a static string  no password  represents a context of  . The callback was called to get  a password to encrypt  something. The callback was called to get  a password to read something  encrypted. , represents a callback function to supply a  password. Int4 The maximum length of the password to be accepted. PemPasswordRWState The context.  IO String The resulting password. ' writes a private key to PEM string in  PKCS# 8 format.  pem supply$ reads a private key in PEM string.  pubkey writes a public to PEM string.  pem# reads a public key in PEM string.  cert, writes an X.509 certificate to PEM string.  pem+ reads an X.509 certificate in PEM string.  writes a PKCS#10 certificate request to PEM  string.  reads a PKCS#&10 certificate request in PEM string.  crl- writes a Certificate Revocation List to PEM  string.  pem4 reads a Certificate Revocation List in PEM string.  p7 writes a PKCS#7 structure to PEM string.  pem reads a PKCS#7 structure in PEM string.    dh% writes DH parameters to PEM string.    pem$ reads DH parameters in PEM string. private key to write Either (symmetric cipher  algorithm, password  supply) or Nothing. If  Nothing is given the  private key is not  encrypted. the result PEM string request format the result PEM string          Safe-Infered/ :A failure in the SSL library occurred, usually a protocol  error.  AThe peer uncleanly terminated the connection without sending the  " close notify" alert. 0The root exception type for all SSL exceptions. only send our shutdown #wait for the peer to also shutdown ?This is the type of an SSL IO operation. Errors are handled by E exceptions while everything else is one of these. Note that reading < from an SSL socket can result in WantWrite and vice versa. !needs more outgoing buffer space !needs more data from the network  operation finished successfully &This is the type of an SSL connection GSSL objects are not thread safe, so they carry a QSem around with them N which only lets a single thread work inside them at a time. Thus, one must < always use withSSL, rather than withForeignPtr directly. JIO with SSL objects is non-blocking and many SSL functions return a error L code which signifies that it needs to read or write more data. We handle J these calls and call threadWaitRead and threadWaitWrite at the correct * times. Thus multiple OS threads can be  inside IO in the same SSL & object at a time, because they aren'%t really in the SSL object, they are 3 waiting for the RTS to wake the Haskell thread. Get the underlying socket Fd ,Get the socket underlying an SSL connection See  7http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html is a certificate required !only request once per connection optional callback =An SSL context. Contexts carry configuration such as a server' s private I key, root CA certiifcates etc. Contexts are stateful IO objects; they L start empty and various options are set on them by the functions in this N module. Note that an empty context will pretty much cause any operation to  fail since it doesn'!t even have any ciphers enabled. GContexts are not thread safe so they carry a QSem with them which only N lets a single thread work inside them at a time. Thus, one must always use - withContext, not withForeignPtr directly.  Create a new SSL context. !&Install a private key into a context. "3Install a certificate (public key) into a context. #KInstall a private key file in a context. The key is given as a path to the M file which contains the key. The file is parsed first as PEM and, if that 9 fails, as ASN1. If both fail, an exception is raised. $JInstall a certificate (public key) file in a context. The key is given as N a path to the file which contains the key. The file is parsed first as PEM F and, if that fails, as ASN1. If both fail, an exception is raised. %JSet the ciphers to be used by the given context. The string argument is a 1 list of ciphers, comma separated, as given at  http:www.openssl.orgdocsapps/ ciphers.html BUnrecognised ciphers are ignored. If no ciphers from the list are ' recognised, an exception is raised. 'KReturn true iff the private key installed in the given context matches the  certificate also installed. )JSet the location of a PEM encoded list of CA certificates to be used when  verifying a server's certificate *CSet the path to a directory which contains the PEM encoded CA root + certificates. This is an alternative to ). See   Bhttp://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html for % details of the file naming scheme +AGet a reference to, not a copy of, the X.509 certificate storage  in the SSL context. ,FWrap a Socket in an SSL connection. Reading and writing to the Socket F after this will cause weird errors in the SSL code. The SSL object J carries a handle to the Socket so you need not worry about the garbage = collector closing the file descriptor out from under you. -'Wrap a socket Fd in an SSL connection. . Perform an SSL server handshake /8Try to perform an SSL server handshake without blocking 0 Perform an SSL client handshake 18Try to perform an SSL client handshake without blocking 2HTry to read the given number of bytes from an SSL connection. On EOF an K empty ByteString is returned. If the connection dies without a graceful ) SSL shutdown, an exception is raised. 3=Try to read the given number of bytes from an SSL connection  without blocking. 4*Read some data into a raw pointer buffer. " Retrns the number of bytes read. 5CTry to read some data into a raw pointer buffer, without blocking. 6GWrite a given ByteString to the SSL connection. Either all the data is : written or an exception is raised because of an error. 7HTry to write a given ByteString to the SSL connection without blocking. 8*Send some data from a raw pointer buffer. 9<Send some data from a raw pointer buffer, without blocking. :@Lazily read all data until reaching EOF. If the connection dies < without a graceful SSL shutdown, an exception is raised. ;>Write a lazy ByteString to the SSL connection. In contrast to  6;, there is a chance that the string is written partway and = then an exception is raised for an error. The string doesn't " necessarily have to be finite. <ECleanly shutdown an SSL connection. Note that SSL has a concept of a L secure shutdown, which is distinct from just closing the TCP connection. < This performs the former and should always be preferred. GThis can either just send a shutdown, or can send and wait for the peer's  shutdown message. =<Try to cleanly shutdown an SSL connection without blocking. >JAfter a successful connection, get the certificate of the other party. If 0 this is a server connection, you probably won't get a certificate unless 4 you asked for it with contextSetVerificationMode ?#Get the result of verifing the peer'"s certificate. This is mostly for L clients to verify the certificate of the server that they have connected L it. You must set a list of root CA certificates with contextSetCA... for  this to make sense. (Note that this returns True iff the peer' s certificate has a valid chain N to a root CA. You also need to check that the certificate is correct (i.e. < has the correct hostname in it) with getPeerCertificate. 9    !"#$%&'()*+,-./0123456789:;<=>?5    !"#$%&'()*+,-./0123456789:;<=>?7 !"#$%&'()*+,-./0123456789:;<=>?   ,    !"#$%&'()*+,-./0123456789:;<=>?$ Safe-Infered Safe-Infered@Computation of @ action initializes the OpenSSL  library and computes action. Every applications that use < HsOpenSSL must wrap any operations related to OpenSSL with  @, or they might crash.  module Main where  import OpenSSL   main :: IO ()  main = withOpenSSL $  do ... @@@@%&'()*+,-./0123456789:;<=>?@AB12CDEFGHIJKLMNOPQRSTUVWXYZ[ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~   "# ! !"#      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwwxyyz.{||}/~                $$$HsOpenSSL-0.10.3.2 OpenSSL.DHOpenSSL.EVP.Base64OpenSSL.EVP.PKeyOpenSSL.EVP.DigestOpenSSL.EVP.CipherOpenSSL.CipherOpenSSL.Random OpenSSL.BN OpenSSL.DSA OpenSSL.RSAOpenSSL.EVP.OpenOpenSSL.EVP.SealOpenSSL.EVP.SignOpenSSL.EVP.Verify OpenSSL.X509OpenSSL.X509.RequestOpenSSL.X509.RevocationOpenSSL.X509.Store OpenSSL.PKCS7 OpenSSL.PEMOpenSSL.SessionOpenSSL OpenSSL.ERR OpenSSL.StackOpenSSL.DH.InternalOpenSSL.Objects OpenSSL.UtilsOpenSSL.EVP.Internal OpenSSL.BIO OpenSSL.ASN1OpenSSL.X509.NamegetSubjectNamesetSubjectName getIssuerName setIssuerName OpenSSL.SSLDHDHP encodeBase64encodeBase64BSencodeBase64LBS decodeBase64decodeBase64BSdecodeBase64LBSPKeyDigestCipher CryptoModeDecryptEncryptgetCipherByNamegetCipherNamescipherStrictLBSciphercipherBS cipherLBSgetDigestByNamegetDigestNamesdigestdigestBS digestBS' digestLBShmacBSpkcs5_pbkdf2_hmac_sha1AESCtxMode newAESCtxaesCBCaesCTR randBytes prandBytesaddBIGNUMBigNumallocaBNunwrapBNwrapBN bnToInteger integerToBNwithBNpeekBNnewBN integerToMPI mpiToIntegermodexp randIntegerUptoNMinusOneSuchThat!prandIntegerUptoNMinusOneSuchThatrandIntegerZeroToNMinusOnerandIntegerOneToNMinusOneprandIntegerZeroToNMinusOneprandIntegerOneToNMinusOneDSAKeydsaSizedsaPdsaQdsaG dsaPublic withDSAPtr peekDSAPtr absorbDSAPtrDSA DSAKeyPair DSAPubKeygenerateDSAParametersgenerateDSAKey dsaPrivatedsaPubKeyToTupledsaKeyPairToTupletupleToDSAPubKeytupleToDSAKeyPairgenerateDSAParametersAndKeysignDigestedDataWithDSAverifyDigestedDataWithDSARSAGenKeyCallbackRSAKeyrsaSizersaNrsaE withRSAPtr peekRSAPtr absorbRSAPtrRSA RSAKeyPair RSAPubKey rsaCopyPublicrsaKeyPairFinalizegenerateRSAKeygenerateRSAKey'rsaDrsaPrsaQrsaDMP1rsaDMQ1rsaIQMP SomeKeyPair SomePublicKeyKeyPair fromKeyPair toKeyPair PublicKey fromPublicKey toPublicKeyopenopenBSopenLBSsealsealBSsealLBSsignsignBSsignLBS VerifyStatus VerifyFailure VerifySuccessverifyverifyBS verifyLBSDHGenDHGen5DHGen2 genDHParams getDHLength checkDHParamsgenDH getDHParamsgetDHPublicKey computeDHKeyX509_X509newX509wrapX509 withX509Ptr withX509StackunsafeX509ToPtr touchX509 compareX509signX509 verifyX509 printX509 getVersion setVersiongetSerialNumbersetSerialNumber getNotBefore setNotBefore getNotAfter setNotAfter getPublicKey setPublicKeygetSubjectEmailX509_REQX509Req newX509Req wrapX509ReqwithX509ReqPtr signX509Req verifyX509Req printX509ReqmakeX509FromReqRevokedCertificaterevSerialNumberrevRevocationDateX509_CRLCRLnewCRLwrapCRL withCRLPtrsignCRL verifyCRLprintCRL getLastUpdate setLastUpdate getNextUpdate setNextUpdategetRevokedList addRevoked getRevokedsortCRL X509StoreCtxX509_STORE_CTX X509_STORE X509Store newX509Store wrapX509StorewithX509StorePtraddCertToStore addCRLToStorewithX509StoreCtxPtrwrapX509StoreCtxgetStoreCtxCertgetStoreCtxIssuergetStoreCtxCRLgetStoreCtxChainPkcs7VerifyStatusPkcs7VerifyFailurePkcs7VerifySuccess Pkcs7Flag Pkcs7CRLFEOLPkcs7NoOldMimeTypePkcs7NoSmimeCap Pkcs7NoAttr Pkcs7Binary Pkcs7Detached Pkcs7NoVerify Pkcs7NoIntern Pkcs7NoChain Pkcs7NoSigs Pkcs7NoCerts Pkcs7TextPKCS7Pkcs7 wrapPkcs7Ptr withPkcs7Ptr pkcs7Sign pkcs7Verify pkcs7Encrypt pkcs7Decrypt writeSmime readSmimePemX509ReqFormat ReqOldFormat ReqNewFormatPemPasswordSupplyPwTTY PwCallbackPwBSPwStrPwNonePemPasswordRWStatePwWritePwReadPemPasswordCallbackwritePKCS8PrivateKeyreadPrivateKeywritePublicKey readPublicKey writeX509readX509 writeX509Req readX509ReqwriteCRLreadCRL writePkcs7 readPkcs7 writeDHParams readDHParams ProtocolErrorConnectionAbruptlyTerminatedSomeSSLException ShutdownTypeUnidirectional Bidirectional SSLResult WantWriteWantReadSSLDoneSSLsslFd sslSocketVerificationMode VerifyPeervpFailIfNoPeerCert vpClientOnce vpCallback VerifyNone SSLContextcontextcontextSetPrivateKeycontextSetCertificatecontextSetPrivateKeyFilecontextSetCertificateFilecontextSetCipherscontextSetDefaultCipherscontextCheckPrivateKeycontextSetVerificationModecontextSetCAFilecontextSetCADirectorycontextGetCAStore connection fdConnectionaccept tryAcceptconnect tryConnectreadtryReadreadPtr tryReadPtrwritetryWritewritePtr tryWritePtrlazyRead lazyWriteshutdown tryShutdowngetPeerCertificategetVerifyResult withOpenSSL peekErrorgetError errorStringSTACKmapStack withStackwithForeignStackDH_ withDHPPtrwrapDHPPtrWith wrapDHPPtr withDHPtr wrapDHPtrWith wrapDHPtrasDHasDHP ObjNameTypeCompMethodTypePKeyMethodTypeCipherMethodType MDMethodType getObjNamestoHexfromHex failIfNull failIfNull_failIffailIf_raiseOpenSSLErrorpeekCStringCLentoPKeyfromPKeypkeySize pkeyDefaultMDEVP_PKEY VaguePKey EVP_MD_CTX DigestCtxEVP_MDEVP_CIPHER_CTX CipherCtx EVP_CIPHER withCipherPtrcipherIvLength newCipherCtxwithCipherCtxPtrwithNewCipherCtxPtrcipherUpdateBS cipherFinalBScipherStrictly cipherLazily withMDPtrwithDigestCtxPtrdigestUpdateBS digestFinalBS digestFinaldigestStrictly digestLazily wrapPKeyPtr createPKey withPKeyPtr withPKeyPtr'unsafePKeyToPtr touchPKeybytestring-0.9.2.1Data.ByteString.Internal ByteStringBIObioPush==><==bioJoinbioFlushbioResetbioEOFbioRead bioReadBS bioReadLBSbioGets bioGetsBS bioGetsLBSbioWrite bioWriteBS bioWriteLBS newBase64 newBuffernewMem newConstMem newConstMemBSnewConstMemLBS newNullBIOBIO_ wrapBioPtr withBioPtr withBioPtr'$fShowDSAKeyPair$fShowDSAPubKey$fOrdDSAKeyPair$fOrdDSAPubKey$fEqDSAKeyPair $fEqDSAPubKey$fDSAKeyDSAKeyPair$fDSAKeyDSAPubKey$fShowRSAKeyPair$fShowRSAPubKey$fOrdRSAKeyPair$fOrdRSAPubKey$fEqRSAKeyPair $fEqRSAPubKey$fRSAKeyRSAKeyPair$fRSAKeyRSAPubKeybase Data.MaybeNothing$fPKeyDSAKeyPair$fPublicKeyDSAKeyPair$fKeyPairDSAKeyPair$fPKeyDSAPubKey$fPublicKeyDSAPubKey$fPKeyRSAKeyPair$fPublicKeyRSAKeyPair$fKeyPairRSAKeyPair$fPKeyRSAPubKey$fPublicKeyRSAPubKey$fPKeySomeKeyPair$fKeyPairSomeKeyPair$fPublicKeySomeKeyPair$fEqSomeKeyPair$fPKeySomePublicKey$fPublicKeySomePublicKey$fEqSomePublicKey ASN1_TIME ASN1_INTEGER ASN1_STRING ASN1_OBJECTobj2nidnid2snnid2lnpeekASN1StringpeekASN1IntegerwithASN1Integer peekASN1Time withASN1Time X509_NAMEallocaX509Name withX509Name peekX509NameGHC.IOblocked$fExceptionProtocolError'$fExceptionConnectionAbruptlyTerminated$fExceptionSomeSSLException$fShowSomeSSLException libraryInitaddAllAlgorithmsloadErrorStrings