| License | BSD-style |
|---|---|
| Maintainer | Kazu Yamamoto <kazu@iij.ad.jp> |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.Debug
Description
Printing secret key material, on purpose.
The Show instance of a type that holds a secret does not print it. That
is deliberate: Show is what print, a message built with error, an
exception and a test framework's failure output all reach for, and a
private key reaching a log or a bug report that way is an accident nobody
asked for. Those instances render the public part and write <secret>
for the rest.
This module is how you print one when printing it is what you mean. What
debugShow returns is what the derived Show used to return, so for the
types that still have a Read instance
read (debugShow k) == k
and a call site that was serializing a key through show moves by one
word.
Needing debugShow in scope is the record of the intent: nothing here is
exported anywhere else, so a search for this module finds every place a key
can be revealed. Do not leave a call to it where production code runs.
Synopsis
- class DebugShow a where
- debugShowBytes :: ByteArrayAccess ba => String -> ba -> String
Documentation
class DebugShow a where Source #
Rendering a value with its secret in place.
Instances
debugShowBytes :: ByteArrayAccess ba => String -> ba -> String Source #