Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agree on key serialization #7

Closed
hardbyte opened this issue Jan 7, 2016 · 4 comments
Closed

Agree on key serialization #7

hardbyte opened this issue Jan 7, 2016 · 4 comments

Comments

@hardbyte
Copy link
Collaborator

hardbyte commented Jan 7, 2016

See #6 - any comments on this api for generating a keypair?

$ python -m bin.pheutil generate --keysize 256 | python -m json.tool
{
    "key_ops": [
        "decrypt"
    ],
    "lambda": "j1fgJ5bHjmuxT1AV0hyvRVxsrZEyqjQ2HHG-jwFNEFQ",
    "kty": "PAI",
    "mu": "CydLXl7SzDLZc0Yy8DZijiPYjkXQNB24g_Lr9GyVCGY",
    "kid": "Paillier private key generated by pheutil on 2016-01-07",
    "pub": {
        "g": "j1fgJ5bHjmuxT1AV0hyvRuP_aqRm4ND2gh4hQ0_qeWo",
        "key_ops": [
            "encrypt"
        ],
        "n": "j1fgJ5bHjmuxT1AV0hyvRuP_aqRm4ND2gh4hQ0_qeWk",
        "kid": "Paillier public key generated by pheutil on 2016-01-07",
        "kty": "PAI"
    }
}
@wilko77
Copy link
Collaborator

wilko77 commented Jan 7, 2016

I don't like 'generate' as it is a bit non-descriptive. How about 'generateKeyPair', 'genKeyPair' or something along those lines.
Maybe add an optional '-out' argument to specify a filename to save the keys to.

@hardbyte
Copy link
Collaborator Author

hardbyte commented Jan 7, 2016

Current interface:


$ python -m bin.pheutil --help
Usage: pheutil.py [OPTIONS] COMMAND [ARGS]...

  CLI for interacting with python-paillier

Options:
  --version      Show the version and exit.
  -v, --verbose  Enables verbose mode.
  --help         Show this message and exit.

Commands:
  encrypt   Encrypt a number with given public key
  extract   Given a private paillier key, as generated by...
  generate  Generate a paillier keypair and output as JWK...


$ python -m bin.pheutil generate --help                                     
Usage: pheutil.py generate [OPTIONS] OUTPUT

  Generate a paillier keypair and output as JWK to given output file.

  Use "-" to output the private key to stdout. See the extract command to
  extract the public component of the private key.

Options:
  --keysize INTEGER  The keysize in bits
  --id TEXT          Add an identifying comment to the key
  --help             Show this message and exit.

$ python -m bin.pheutil generate --keysize 128 --id "Brian Test" bttest.priv
Generating a paillier keypair with keysize of 128
Keys generated
Private key written to bttest.priv
$ cat bttest.priv 
{"kid": "Paillier private key generated by pheutil on 2016-01-07", "lambda": "kuncTSpnnBNeDib8b7GKQA", "kty": "PAI", "pub": {"kid": "Paillier public key generated by pheutil on 2016-01-07", "kty": "PAI", "g": "kuncTSpnnBTiZemNCa2k7A", "key_ops": ["encrypt"], "n": "kuncTSpnnBTiZemNCa2k6w"}, "mu": "IFNt1tfzOisId8LVCcdyfA", "key_ops": ["decrypt"]}

@mpnd
Copy link

mpnd commented Jan 7, 2016

I agree with Wilko about generate command.

Also, I notice that the descriptions of the commands are cut off (I was wondering what extract do, until I had a look at the detail description for generate).

hardbyte added a commit that referenced this issue Jan 8, 2016
#6 Increase timestamp resolution in default id comment. Add warning message to help
#7 Include "alg" in key serialization
#8 start to encrypt numbers from tool
@hardbyte
Copy link
Collaborator Author

Closing as most discussion regarding the key serialisation is happening in #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants