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

Cleanup import-export and key architecture #806

Closed
3 tasks done
endophage opened this issue Jun 28, 2016 · 4 comments
Closed
3 tasks done

Cleanup import-export and key architecture #806

endophage opened this issue Jun 28, 2016 · 4 comments
Assignees

Comments

@endophage
Copy link
Contributor

endophage commented Jun 28, 2016

Thought there was an issue, apparently not. As discussed in the past, key storage should be cleaned up to have clear logical divisions. At the top level, a CryptoService should deal in operations: sign, create, etc... trustmanager.KeyStore should speak Public/PrivateKey objects, and the trustmanager.Storage interface should speak in []byte.

Import/Export should then operate against a either the KeyStore, or Storage interface (TBD, based on password requirements).

We're going to go about cleaning this up in 3 steps as trying to do it all at once turned into a big mess that prevented me getting it commited last time. In order the steps are:

@endophage endophage self-assigned this Jun 28, 2016
@HuKeping
Copy link
Contributor

Maybe we should put on a label like breaking-change with red background color here to remind people that it could be not any guarantee of backwards compatibility with importing already exported keys.

But since it was not on a v1.0 yet, it's fine to do so.

@endophage
Copy link
Contributor Author

@HuKeping great idea! Will create and add the label now

@endophage
Copy link
Contributor Author

endophage commented Jul 6, 2016

@HuKeping @andrewhsu I've been talking with the team here at Docker and we think an easy way to re-implement import/export is to use .pem files which already support containing multiple unique PEM blocks.

Export will pack all the keys being exported into a single .pem file, each delineated as a unique PEM block. Import can take any number of .pem files and will unpack each individual PEM block into a separate file.

I propose the following command formats:

notary export     # with no further arguments, exports all private keys on the host
notary export --gun my_gun [--gun my_gun]    # online operation that exports all keys currently valid within the gun(s). Flag can be provided multiple times 
notary export --key <keyID> [--key <keyID>]...   # exports only the provided key IDs. Flag can be provided multiple times.

notary import file1.pem file2.pem ...

All export commands will output to stdout by default and will take a -o flag to provide an output file. Current I do not intend to allow mixing the --gun and --key flags, but I may make it possible depending on the emergent ease/difficulty found during implementation. That flexibility could also be added at a later time, there's no inherent reason why it shouldn't be possible.

cc @riyazdf @cyli

@HuKeping
Copy link
Contributor

HuKeping commented Jul 7, 2016

Sounds good and I also think the scenario that wants to export all keys of one gun and one/two keys of another is not that common.

endophage added a commit that referenced this issue Jul 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants