From b7ce16ab6f68e75ac96973939d40cce6a01762a0 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Wed, 28 Oct 2015 19:24:51 -0700 Subject: [PATCH] fixes for Diogo's comments Signed-off-by: David Lawrence (github: endophage) --- cryptoservice/crypto_service.go | 2 +- keystoremanager/keystoremanager_test.go | 6 +++--- signer/api/rsa_hardware_crypto_service.go | 2 +- signer/signer_trust.go | 2 +- tuf/signed/ed25519.go | 2 +- tuf/signed/interface.go | 2 +- tuf/signed/sign_test.go | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cryptoservice/crypto_service.go b/cryptoservice/crypto_service.go index 85dc0809a6..9b166b93c8 100644 --- a/cryptoservice/crypto_service.go +++ b/cryptoservice/crypto_service.go @@ -33,7 +33,7 @@ func NewCryptoService(gun string, keyStore trustmanager.KeyStore) *CryptoService } // Create is used to generate keys for targets, snapshots and timestamps -func (ccs *CryptoService) Create(role string, algorithm string) (data.PublicKey, error) { +func (ccs *CryptoService) Create(role, algorithm string) (data.PublicKey, error) { var privKey data.PrivateKey var err error diff --git a/keystoremanager/keystoremanager_test.go b/keystoremanager/keystoremanager_test.go index a12bf95ba6..24c9f95fb7 100644 --- a/keystoremanager/keystoremanager_test.go +++ b/keystoremanager/keystoremanager_test.go @@ -220,7 +220,7 @@ func TestValidateSuccessfulRootRotation(t *testing.T) { } } -func testValidateSuccessfulRootRotation(t *testing.T, keyAlg string, rootKeyType string) { +func testValidateSuccessfulRootRotation(t *testing.T, keyAlg, rootKeyType string) { // Temporary directory where test files will be created tempBaseDir, err := ioutil.TempDir("", "notary-test-") defer os.RemoveAll(tempBaseDir) @@ -306,7 +306,7 @@ func TestValidateRootRotationMissingOrigSig(t *testing.T) { } } -func testValidateRootRotationMissingOrigSig(t *testing.T, keyAlg string, rootKeyType string) { +func testValidateRootRotationMissingOrigSig(t *testing.T, keyAlg, rootKeyType string) { // Temporary directory where test files will be created tempBaseDir, err := ioutil.TempDir("", "notary-test-") defer os.RemoveAll(tempBaseDir) @@ -389,7 +389,7 @@ func TestValidateRootRotationMissingNewSig(t *testing.T) { } } -func testValidateRootRotationMissingNewSig(t *testing.T, keyAlg string, rootKeyType string) { +func testValidateRootRotationMissingNewSig(t *testing.T, keyAlg, rootKeyType string) { // Temporary directory where test files will be created tempBaseDir, err := ioutil.TempDir("", "notary-test-") defer os.RemoveAll(tempBaseDir) diff --git a/signer/api/rsa_hardware_crypto_service.go b/signer/api/rsa_hardware_crypto_service.go index 2c64278f36..67a60bdd37 100644 --- a/signer/api/rsa_hardware_crypto_service.go +++ b/signer/api/rsa_hardware_crypto_service.go @@ -23,7 +23,7 @@ type RSAHardwareCryptoService struct { } // Create creates a key and returns its public components -func (s *RSAHardwareCryptoService) Create(role string, algo string) (data.PublicKey, error) { +func (s *RSAHardwareCryptoService) Create(role, algo string) (data.PublicKey, error) { // For now generate random labels for keys // (diogo): add link between keyID and label in database so we can support multiple keys randomLabel := make([]byte, 32) diff --git a/signer/signer_trust.go b/signer/signer_trust.go index f3441db289..05661e93b7 100644 --- a/signer/signer_trust.go +++ b/signer/signer_trust.go @@ -77,7 +77,7 @@ func (trust *NotarySigner) Sign(keyIDs []string, toSign []byte) ([]data.Signatur } // Create creates a remote key and returns the PublicKey associated with the remote private key -func (trust *NotarySigner) Create(role string, algorithm string) (data.PublicKey, error) { +func (trust *NotarySigner) Create(role, algorithm string) (data.PublicKey, error) { publicKey, err := trust.kmClient.CreateKey(context.Background(), &pb.Algorithm{Algorithm: algorithm}) if err != nil { return nil, err diff --git a/tuf/signed/ed25519.go b/tuf/signed/ed25519.go index b3541d6dd5..d7b08d8e10 100644 --- a/tuf/signed/ed25519.go +++ b/tuf/signed/ed25519.go @@ -50,7 +50,7 @@ func (e *Ed25519) Sign(keyIDs []string, toSign []byte) ([]data.Signature, error) } // Create generates a new key and returns the public part -func (e *Ed25519) Create(role string, algorithm string) (data.PublicKey, error) { +func (e *Ed25519) Create(role, algorithm string) (data.PublicKey, error) { if algorithm != data.ED25519Key { return nil, errors.New("only ED25519 supported by this cryptoservice") } diff --git a/tuf/signed/interface.go b/tuf/signed/interface.go index dd00a0194b..b83fb76651 100644 --- a/tuf/signed/interface.go +++ b/tuf/signed/interface.go @@ -20,7 +20,7 @@ type KeyService interface { // the private key into the appropriate signing service. // The role isn't currently used for anything, but it's here to support // future features - Create(role string, algorithm string) (data.PublicKey, error) + Create(role, algorithm string) (data.PublicKey, error) // GetKey retrieves the public key if present, otherwise it returns nil GetKey(keyID string) data.PublicKey diff --git a/tuf/signed/sign_test.go b/tuf/signed/sign_test.go index 00819d52cc..c8c047eec8 100644 --- a/tuf/signed/sign_test.go +++ b/tuf/signed/sign_test.go @@ -29,7 +29,7 @@ func (mts *FailingCryptoService) Sign(keyIDs []string, _ []byte) ([]data.Signatu return sigs, nil } -func (mts *FailingCryptoService) Create(_ string, _ string) (data.PublicKey, error) { +func (mts *FailingCryptoService) Create(_, _ string) (data.PublicKey, error) { return mts.testKey, nil }