Commit Graph

22 Commits

Author SHA1 Message Date
Miloslav Trmač 229d64e0e0 Use ErrKeyNotFound in KeyStore.GetKey
3 out of 4 KeyStore implementations have already been returning this
type or a pointer to it; document this as a requirement, and modify
implementations to comply.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2016-04-12 14:33:46 -07:00
Riyaz Faizullabhoy f0e7be69c9 Update to use require for cryptoservice package
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-04-04 13:58:56 -07:00
Riyaz Faizullabhoy e1613cdcb2 Address review comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:31:07 -07:00
Riyaz Faizullabhoy 1ed9c352d7 change ks.AddKey to be consistent with CryptoService
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:31:06 -07:00
Riyaz Faizullabhoy 9ecd899e25 Removing key import and gun from cryptoservice
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:31:03 -07:00
Riyaz Faizullabhoy c7bccd79e3 addressing review comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:06:39 -07:00
Riyaz Faizullabhoy 2a37590ea6 update interface and comments
Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
2016-03-18 11:06:37 -07:00
Miloslav Trmač 57a15112c8 Fix error handling on invalid root passphrase
When the user insists on an invalid passphrase (or aborts the
operation), CryptoService.GetPrivateKey will try the correct root
location first, correctly failing, and then try to look for the root key
in the $gun subdirectory, and so will return the last error, a confusing
”open $path: no such file or directory”.

So, recognize the passphrase-related errors and fail with them directly.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2015-12-09 19:58:02 +01:00
Miloslav Trmač d3c3d70d6d Add gun to CryptoServiceTester
The gun field is not necessary yet, but will be useful in a future
commit. But including it immediately allows us to simplify by using
an ordinary method for cryptoServiceFactory instead of closures.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2015-12-09 19:45:34 +01:00
David Lawrence ae7459b5f2 updating commend and renaming test per comments
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-11-30 16:53:08 -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
Ying Li 5d0893ef2a Oops, it'd be helpful if we actually ran the new CryptoService tests.
Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
2015-11-12 01:14:01 -08:00
Ying Li efff721955 Add tests for multi-keystore crypto services.
Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
2015-11-12 01:13:49 -08:00
Ying Li 2a9e163bd2 Fixed cryptoservice.Create to call keyStore.AddKey with a GUN only if
it is not a root role.

Updated the cryptoservice tests to test all key algorithms, all roles,
and cryptoservices without a GUN.  This then also found bugs in
cryptoservice.GetKey, cryptoservice.RemoveKey, and
cryptoservice.GetPrivateKey, which weren't really being exercised
previously.

Signed-off-by: Ying Li <ying.li@docker.com>
Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Ying Li <ying.li@docker.com> (github: endophage)
2015-11-12 01:08:57 -08:00
David Lawrence 06990fd5a1 integreating with @cyli's improvements
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
2015-10-30 10:15:52 -07: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
Nathan McCauley 0642da80f1 review feedback
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -07:00
Nathan McCauley 38fe6bd45b gofmt across the baord
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
2015-07-20 11:00:24 -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
Aaron Lehmann 48f3be4722 Increase test coverage for CryptoService
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-17 17:32:32 -07:00
Aaron Lehmann f5c1d8dbc9 Add ED25519 support to cryptoservice and x509utils
Add unit tests for cryptoservice that do sign and verify for all three
supported algorithms.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-07-16 18:44:44 -07:00