Commit Graph

24 Commits

Author SHA1 Message Date
Aaron Lehmann e5a42d4df9 Add ExportKeysByGUN function
It exports the keys for a particular GUN to a zip, encrypted with a
specified passphrase.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:57 -07:00
Aaron Lehmann 6d3d98b873 Move non-root keys to tuf_keys subdirectory
This subdirectory is at the same level as root_keys. It avoids having
rootKeyStore and nonRootKeyStore overlap. Previously, the base directory
for rootKeyStore was .../private/root_keys and the base directory for
nonRootKeyStore was .../private.

This commit also removes deduplicating logic in ExportAllKeys, which is
no longer needed now that the stores don't overlap.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:14:57 -07:00
Aaron Lehmann a16581ecc7 Move CryptoService and UnlockedCryptoService into a cryptoservice package
Move GenRootKey and GetRootCryptoService to KeyStoreManager, now that
they don't depend on client-specific types.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 18:39:38 -07:00
Aaron Lehmann 6068f30145 Move caStore and certificateStore into KeyStoreManager
Refactor validateRoot into KeyStoreManager. It now takes the DNS name as
a parameter. When KeyStoreManager is used with a NotaryRepository, the
DNS name should be the GUN of the repository.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 18:39:38 -07:00
Aaron Lehmann d5c7c40955 Introduce a KeyStoreManager to abstract management of root and non-root key storage
This structure encapsulates what used to be "rootKeyStore" and
"privKeyStore". These are being moved out of NotaryRepository, so that
operations like listing keys, importing keys, and exporting keys aren't
tied to a NotaryRepository structure.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 18:39:38 -07:00
Aaron Lehmann e4704f9729 Update notary for removal of signed.Signer
We now deal with CryptoServices directly instead of passing around
Signers.

UnlockedSigner becomes UnlockedCryptoService because it no longer
contains a Signer.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-13 15:18:02 -07:00
Diogo Monica 765a2cf661 Refactor crypto service
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-13 13:53:47 -07:00
Diogo Monica ba94fdd19d Signature/key types are now used correcty and are represented by constants.
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-12 22:21:29 -07:00
Diogo Monica 085c613527 Refactored fingerprint cert and added better debugging
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-12 22:21:29 -07:00
Diogo Monica 39482c2397 Working ECDSA implementation
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-12 22:21:29 -07:00
Aaron Lehmann a45c3e3965 Modify TestAddTarget to make TestAddListTarget
This test now checks ListTargets and GetTargetByName as well. To do
this, it needs to expose signed metadata files over the internal HTTP
server. This means adding the timestamp private key to the key store and
exposing various json files as endpoints that serialize the necessary
data.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-10 10:19:14 -07:00
David Lawrence d1b09962f1 using roundtripper in notary client
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-10 10:02:38 -07:00
Diogo Monica 1ae9cf057e Removing dangling temp test directories 2015-07-09 21:03:54 -07:00
Aaron Lehmann 082d4f3c7c Change NotaryRepository to honor the baseURL passed in
Remove "transport", because it's not used.

In the actual notary client, pass in a hard-coded URL for now (same one
previously hardcoded in getRemoteStore). In tests, create a trivial HTTP
server using net/http/httptest, which returns a timestamp.key file.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-09 17:58:33 -07:00
Diogo Monica 8c6de46aca Added list keys that ignores symlinks 2015-07-09 17:58:10 -07:00
Diogo Monica 6738a40cd8 Rebased and fixed issues 2015-07-09 17:58:09 -07:00
Aaron Lehmann 4f6b2da44d Add TestValidateRootKey, validates presence of x509 cert in root.json 2015-07-09 17:58:09 -07:00
Aaron Lehmann abe320307d Add TestAddTarget
This test adds two targets, and after each one, inspects the changelist
files to make sure they meet expectations.
2015-07-09 17:58:09 -07:00
David Lawrence 6bff14a679 refactoring NotaryClient out
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-09 17:58:09 -07:00
Diogo Monica f9f11e5781 Starting the key refactor; rename UnlockedRootKey
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-09 17:58:09 -07:00
Aaron Lehmann aa2caade20 Convert client_test.go to use testify
This simplifies the code and will be more consistent with upcoming
tests.
2015-07-09 17:58:09 -07:00
Aaron Lehmann 4602f5fb6c Extend TestInitRepo to parse and sanity-check TUF metadata 2015-07-09 17:58:09 -07:00
Aaron Lehmann 42e3f1a1c0 Use trustmanager.FingerprintCert instead of more complex method 2015-07-09 17:58:09 -07:00
Aaron Lehmann 458a7a8fac Add TestInitRepo
This test initializes a repo and then performs a series of sanity checks
on the filesystem hierarchy.
2015-07-09 17:58:09 -07:00