crypton-2.2.5: Cryptography Primitives
LicenseBSD-style
MaintainerKazu Yamamoto <kazu@iij.ad.jp>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

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

Documentation

class DebugShow a where Source #

Rendering a value with its secret in place.

Methods

debugShow :: a -> String Source #

Render the value, secret included.

Instances

Instances details
DebugShow SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Curve25519

DebugShow SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Curve448

DebugShow PrivateNumber Source # 
Instance details

Defined in Crypto.PubKey.DH

DebugShow KeyPair Source # 
Instance details

Defined in Crypto.PubKey.DSA

DebugShow PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.DSA

DebugShow KeyPair Source # 
Instance details

Defined in Crypto.PubKey.ECC.ECDSA

DebugShow PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.ECC.ECDSA

DebugShow SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Ed25519

DebugShow SecretKey Source # 
Instance details

Defined in Crypto.PubKey.Ed448

DebugShow KeyPair Source # 
Instance details

Defined in Crypto.PubKey.RSA.Types

DebugShow PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.RSA.Types

DebugShow PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Basic

DebugShow PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.Modified

DebugShow PrivateKey Source # 
Instance details

Defined in Crypto.PubKey.Rabin.RW

DebugShow (SecretKey curve) Source # 
Instance details

Defined in Crypto.PubKey.EdDSA

Methods

debugShow :: SecretKey curve -> String Source #

DebugShow (SigningKey p) Source # 
Instance details

Defined in Crypto.PubKey.MLDSA

debugShowBytes :: ByteArrayAccess ba => String -> ba -> String Source #

Render a secret that is held as bytes, in hexadecimal. The secret keys that keep theirs in a ScrubbedBytes never had a Show that printed it, so unlike the rest of this module what comes back is for reading and not for read.