EGA-archive / crypt4gh

GA4GH cryptographic tools
http://crypt4gh.readthedocs.io
Apache License 2.0
18 stars 12 forks source link

Multiple recipient features #17

Closed grbot closed 4 years ago

grbot commented 4 years ago

Would it be possible to add two features?

1) That will allow for multiple recipients to be added in the encryption process. Multiple recipients would then be able to decrypt the message.

2) In re-encryption to be allowed to add an additional recipient to the header without encrypting the data packet again. The result would be multiple recipients in the header and in turn multiple recipients can decrypt the message.

silverdaz commented 4 years ago

Sure! The Crypt4GH format allows that, but there was no need so far to implement it at the command-line level.

What do you say if we implement point (1) as follows:

By specifying multiple times the --recipient_pk switch, we'd accept a set of public keys, and create a header packet for each of them. I'm not sure docopt supports that... If not, I'm not so found of specifying a comma-separated list and split it. It looks ugly.

About point (2), I think we can do the same as the above, one packet must be decryptable by the caller, of course, and then we'd reencrypt the packets for the list of recipients... Does that sound right?

grbot commented 4 years ago

Thanks @silverdaz your idea of implementing (1) and (2) sounds right.

silverdaz commented 4 years ago

Can you try the PR #18 and let me know if that works for you?

Maybe we should devise a test for it, such as:

What do you say? Can you write the test and add it to the testsuite?

grbot commented 4 years ago

@silverdaz thank you it works and I've tested as you said.

I've also created a test for the test suite but not sure what is the correct process to add it. Do I send a PR?

grbot commented 4 years ago

For now I've added the two tests here and here.

silverdaz commented 4 years ago

Yes, make a PR from your repo/branch to the branch multiple-recipients. Thanks!

But create a separate file with the tests. I suggest to name it multiple_recipients.bats.

silverdaz commented 4 years ago

The package on PyPI is also updated. I bumped the version to 1.2. You should be able to pip install --upgrade crypt4gh and get the newest version.