| License | BSD-style |
|---|---|
| Stability | experimental |
| Portability | Good |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.PubKey.RSA.Blinded
Description
An RSA private key that keeps its blinding between operations.
Blinding hides the private-key operation's input from timing: it is
multiplied by r^e for a random r first, and the result by r^-1
after. Drawing a new r costs a modular inverse and an exponentiation,
about a tenth of an RSA-2048 signature. A BlindedKey draws one and
squares the pair for each use after it, which is what OpenSSL does, and
draws a new one every 32 uses, from the MonadRandom
the operation runs in.
The key is threaded through the operations as a hash context is: each
function in Crypto.PubKey.RSA.PKCS15, Crypto.PubKey.RSA.PSS and
Crypto.PubKey.RSA.OAEP whose name ends in Blinded returns the key for
the next one. The Safer functions there keep a BlindedKey per key
themselves, for the last few keys used, so they get the same saving
without one being passed.
Synopsis
- data BlindedKey
- blindedKey :: PrivateKey -> BlindedKey
- blindedPrivateKey :: BlindedKey -> PrivateKey
Documentation
data BlindedKey Source #
A private key together with the blinding its next operation uses.
Each operation multiplies the input by r^e and the output by r^-1, and
returns the key with both squared for the next one, so a pair costs two
multiplications after the first. A new r is drawn every 32 operations.
Use the key an operation returns: handing the same one to two operations
gives both the same pair.
blindedKey :: PrivateKey -> BlindedKey Source #
A BlindedKey for a private key. The first pair is drawn when it is
first used.
blindedPrivateKey :: BlindedKey -> PrivateKey Source #
the key it was made from