Commit Graph

28 Commits

Author SHA1 Message Date
Diogo Monica 3154aa9d29 Adding tests for CertsToRemove, and move tests around
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-22 19:08:01 -07:00
Diogo Monica b8b59dbc20 Fixed but with listDirectory and added tests
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-20 19:48:17 -07:00
Aaron Lehmann 1aced67471 Improvements to keystore caching
* RemoveKey must purge the cache entry

* Add mutexes to KeyFileStore and KeyMemoryStore so the cachedKeys map
  is protected in the case that keystore operations happen from multiple
  goroutines

* Change GetKey to return the alias along with the key. Remove
  GetKeyAlias. This simplifies the code flows that retrieve the alias
  (since they usually get the key and alias together).

* Fix tests affected by key caching

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-20 13:36:03 -07:00
Derek McGowan c35c1ea254 Move passphrase logic to its own package
The logic to retrieve passphrase is generic and may be used by directly by clients.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-07-20 13:02:05 -07:00
Nathan McCauley de6f65b7e7 many testing fixups to support key aliasing
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:22 -07:00
Nathan McCauley 5df1eb21f3 keystore aliasing, take 1
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 10:58:20 -07:00
Nathan McCauley 23b7e8c6af Update keyfilestore to use passwordRetriever
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 10:58:16 -07:00
Diogo Monica 3b261e8972 Removing comments
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-20 10:08:15 -07:00
Diogo Monica 1e9365a384 Addressed small nits
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-19 13:43:54 -07:00
Diogo Monica cf9e6499e1 Addressing comments
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-19 01:45:43 -07:00
Diogo Monica 31e1ec122f Adding leaf cert expiry filtering and best-effort rotation
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-18 20:31:19 -07:00
Diogo Monica c3bc4dbccc New root now verified when there are existing certs
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-18 17:52:08 -07:00
Diogo Monica 0abc2ad111 Refactored ValidateRoot Logic
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-18 01:44:01 -07:00
David Lawrence d453c6548d client side of multi TUF file atomic update
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-07-17 17:48:06 -07:00
Diogo Monica f532550742 Rebase works
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:44:51 -07:00
Diogo Monica 4c805611d0 Adding more error types and being extra careful with checks
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:33:06 -07:00
Diogo Monica c817ba3606 Fixed bug in Root Validation and added more test
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:33:05 -07:00
Diogo Monica 1c10f2233d Add better comments, debug code and errors to ValidateRoot
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:33:05 -07:00
Diogo Monica e72141f38a Simplifying the root rotation logic
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:31:43 -07:00
Diogo Monica 5354c3b191 Added logic for root certificate rotation
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:31:43 -07:00
Diogo Monica 8d9d2f1dde Add TOFU logic
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:31:43 -07:00
Diogo Monica a7d8cb0a19 Adding chain support for roots.json and scaning for leaf instead of hardcoding
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-17 14:31:03 -07:00
Aaron Lehmann d2ea9cc0d5 Updates to notary for gotuf's split of PublicKey and PrivateKey interfaces
Functions should now take data.PublicKey or data.PrivateKey instead of
data.Key.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 11:35:22 -07:00
Aaron Lehmann 36a8f77129 Rename certificate stores to trustedCertificateStore and trustedCAStore
Add convenience methods to KeyStoreManager to add certs to both cert
stores.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 18:10:53 -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