Commit Graph

11 Commits

Author SHA1 Message Date
HuKeping 74d4af37a3 Stop injecting to the helper function
GetCryptoService is a helper function and we have injected a specific
http.ResponseWriter object for it to write back error message. Meanwhile
the caller for that function checks whether the cryptoService is nil
or not and return immediately if it is nil.

I think it's not a good idea to write back HTTP response in the helper function,
it's the caller's work and thus there is no need to inject the specific
ResponseWriter object into it.

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-12-30 09:42:51 +08:00
HuKeping f147a7ac68 Use canonical way to check if a map contains a key
As the language spec:
https://golang.org/ref/spec#Index_expressions

Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-12-11 14:07:38 +08:00
David Lawrence 4261d28d46 fixing incomplete comment as raised in #340
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-12-07 16:12:09 -08:00
David Lawrence 1e091a0f56 CryptoService.Sign is now dead code. Remove it and update tests
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-30 16:36:34 -08:00
David Lawrence f73560d839 creating concrete types for the various key ciphers
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-28 16:02:55 -07:00
David Lawrence 2833a88292 adding gotuf to notary
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-27 16:36:06 -07:00
Aaron Lehmann 125d72fd77 Big refactor to make signer use cryptoservices
- Add MemoryFileStore, a partial FileStore implementation that doesn't
  persist on disk.

- Create a KeyStore interface that allows pluggable key store types. Use
  this interface in the cryptoservice implementation.

- Add KeyMemoryStore, which uses MemoryFileStore to provide a KeyStore.

- Add GetKey and DeleteKey functions to cryptoservice.CryptoService.

- Refactor the hardware RSA signing service as a CryptoService.

- Replace custom ed25519 code with cryptoservice.CryptoService.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 09:33:19 -07:00
Aaron Lehmann 167a07c894 Change notary-signer to use gotuf's key types
This causes notary-signer to use gotuf's Key interface instead of
defining its own redundant types.

We can go further with this in the future by removing the redundant
ED25519 implementation. This would be refactored into the cryptoservice
package, and notary-signer would be changed to use that package's
cryptoservice for key creation and signing operations.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-15 17:22:46 -07:00
Aaron Lehmann e7e9ef4a0d Don't hardcode RSA algorithm
When we need to find a key from its ID, search all available signing
services. There should only be a few, so this shouldn't have much
overhead. This avoids the need to maintain a persistent mapping between
key ID and the responsible signing service.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-14 10:49:43 -07:00
Diogo Monica f03626a10e Refactored Rufus API
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 00:23:38 -07:00
Diogo Monica 9a4c2dc744 Initial copy of notary-signer
Signed-off-by: Diogo Monica <diogo@docker.com>
2015-07-14 00:23:22 -07:00