Skip to content
Snippets Groups Projects

Add a tool for extracting the public key from a signing key

Merged Jean-Paul Calderone requested to merge get-public-key into main

If you have a Ristretto signing key then this gives you a tool for easily finding the public key.

Here's an example:

$ ./result/bin/PaymentServer-get-public-key <ristretto.signing-key 
ogzbCbwIl8qYQkpH1pWoAcJnSpv+UGCHveuEMr471Ew=

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 - | Extract a public key from Ristretto-flavored PrivacyPass signing key read from stdin.
2 module Main
3 ( main
4 ) where
5
6 import Prelude hiding
7 ( putStrLn
8 , getLine
9 )
10
11 import Data.Text.IO
12 ( putStrLn
13 , getLine
14 )
  • Created by: tomprince

    Do you need both of these imports?

  • More or less. getLine to read the private key from stdin as a Data.Text.Text and then putStrLn to write the Data.Text.Text that represents the public key to stdout.

    There's probably an entirely different way to manage it but as far as I can tell sticking entirely to Data.Text.IO functions is reasonable.

  • Created by: tomprince

    Do you also need to import the version from Prelude?

  • import Prelude hiding
      ( putStrLn
      , getLine
      )

    has the opposite meaning. It means "add everything from Prelude to this namespace (this is the default if you don't do anything) except putStrLn and getLine". So this is (more or less) necessary to avoid having the next import make these two names ambiguous.

    The Prelude import could be dropped but then these two names have to be referred to qualified (eg Data.Text.IO.getLine) to avoid the ambiguity.

  • Created by: tomprince

    Review: Approved

    The code looks reasonable, though I've not tested it.

  • Please register or sign in to reply
    Loading