Commit Graph

27 Commits

Author SHA1 Message Date
Crockett
0fb8a73d3b Fixed compiler warnings 2019-02-03 16:06:05 -08:00
Olivier Chéron
1d5947f055 Use any instead of not all 2019-01-15 21:24:31 +01:00
Olivier Chéron
f9ae52327c RSASSA-PSS with key of arbitrary length
Instead of public_size / private_size which are in bytes only, this
uses function numBits to recover the effective length of the modulus
in bits.  The patch also handles removal of unneeded initial byte when
the length is 1 modulo 8.
2019-01-12 17:43:49 +01:00
Olivier Chéron
274911c608 Accept hlint suggestions 2019-01-12 17:43:49 +01:00
Olivier Chéron
d964064d80 Use heterogeneous equality 2019-01-12 17:43:49 +01:00
Olivier Chéron
f4e094aacb Fix PKCS#1 v1.5 padding
The padding string is at least 8 bytes long + 3 other bytes,
so it should be 11.
2018-10-29 20:43:02 +01:00
Chris Martin
d2da00445d fix spelling of "exponent" 2018-04-05 21:44:40 -04:00
Chris Martin
f77994a729 Various documentation copy editing 2017-11-18 14:27:44 -05:00
Fraser Tweedale
f6c1f21e59 clarify padding requirements for PKCS15 encrypt/decrypt
The types do not say whether it is necessary to apply pad/unpad to
the input/output of the PKCS15 encrypt/decrypt functions.  Add
comments to clarify that it is not necessary to manually pad/unpad
the message.
2017-06-26 15:30:01 +02:00
Baojun Wang
a8902fe119 remove redundant condition test on `hashLen /= B.length mHash` 2017-05-18 21:00:14 -07:00
Baojun Wang
4270f00277 Use `Digest hash` to represent message digest 2017-05-16 10:54:31 -07:00
Baojun Wang
f9a0bc3c53 Allow sign/verify digest directly
currently sign/verify works on message directly, it would be nice if PSS could sign/verify digest directly. This is useful for:

  1) for some signing server it only has a digest (without message)
  2) message could be very large, for cases when client need request a singing server to sign, it may make more sense for the client to compute digest, then ask server to (PSS) sign the digest
  3) openSSL pkeyutl (PSS) sign operation signs with digest only, not the message, it would be nice to work with openSSL more easily 

*openSSL command line:
```shell
openssl pkeyutl -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:-1  -pkeyopt digest:sha256 -sign -inkey "pri.key" -in hmac.bin > sig.bin
openssl pkeyutl -pkeyopt rsa_padding_mode:pss -pkeyopt rsa_pss_saltlen:-1  -pkeyopt digest:sha256 -verify -inkey "pri.key" -in hmac.bin -sigfile sig.bin
```
2017-05-15 19:42:19 -07:00
Vincent Hanquez
7928198923 [doc] Add missing documentation call 2015-11-04 15:18:05 +00:00
Vincent Hanquez
0d2290a4a1 [RSA] allow data to be passed as is, instead of hashed 2015-06-19 11:04:37 +01:00
Vincent Hanquez
39cf449ba7 add some missing instance of HashAlgorithmASN1 2015-06-19 11:04:17 +01:00
Vincent Hanquez
a9df2a2180 [RSA] remove hashdescr in favor of just specifying the algorithm directly
The extra information is embedded in the HashAlgorithmASN1 class
that allow a digest to ASN1 structured.
2015-06-10 12:27:37 +01:00
Luke Taylor
4e1437d4fd Minor haddock fixes
Fix some incorrect parameter descriptions and spelling/typos.
2015-06-07 13:26:26 +02:00
Vincent Hanquez
8eaaa06e1e add optional support for deepseq 2015-05-22 18:35:46 +01:00
Vincent Hanquez
28958a6d03 [RSA] remove ByteString from Primitive module 2015-05-21 14:32:53 +01:00
Vincent Hanquez
c111dfeb8e [pubkey] remove bytestring from MaskGenFunction 2015-05-21 11:09:48 +01:00
Vincent Hanquez
c7de32a6f6 [RSA] remove the need for bytestring in HashDescr and work towards more removal 2015-05-21 09:46:13 +01:00
Vincent Hanquez
8065c26c2d remove dangerous OverloadedStrings 2015-05-21 06:45:46 +01:00
Vincent Hanquez
dc34ce8289 [RSA] properly indent modules imports 2015-05-21 06:35:19 +01:00
Vincent Hanquez
db7c3bbb4f [hash] massive overhaul of the hash interface
use the typeclass for the lowest IO impure C bindings definitions,
and define the pure interface as generic on top of this.

At the same time define an Hash.IO interface to allow mutable manipulations
of hash contextes when necessary.

Use HashAlgorithm instead of HashFunction in the [PubKey] sections

Tweak the HMAC, PBKDF2 functions to be more efficient and use the new interface
2015-04-30 06:18:07 +01:00
Vincent Hanquez
6eae9b0557 fix warnings 2015-04-05 12:19:26 +01:00
Vincent Hanquez
b556bdb649 add missing modules 2015-04-03 07:33:16 +01:00
Vincent Hanquez
b1e222cf3d merge crypto-pubkey-types and crypto-pubkey
adapt CPRG to MonadRandom
2015-04-03 07:33:16 +01:00