updating per Diogo's comments

Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
David Lawrence 2015-11-10 11:01:54 -08:00
parent c08e732f9f
commit 05c5615187
3 changed files with 4 additions and 5 deletions

View File

@ -115,7 +115,7 @@ func (e *Ed25519) GetPrivateKey(keyID string) (data.PrivateKey, string, error) {
if k, ok := e.keys[keyID]; ok {
return k.privKey, k.role, nil
}
return nil, "", errors.New("Key not found " + keyID)
return nil, "", trustmanager.ErrKeyNotFound{KeyID: keyID}
}
// ImportRootKey adds an Ed25519 key to the store as a root key

View File

@ -44,7 +44,7 @@ func Sign(service CryptoService, s *data.Signed, keys ...data.PublicKey) error {
privKeys[key.ID()] = k
}
// Check to ensure we have at least on signing key
// Check to ensure we have at least one signing key
if len(privKeys) == 0 {
return ErrNoKeys{keyIDs: ids}
}
@ -68,7 +68,7 @@ func Sign(service CryptoService, s *data.Signed, keys ...data.PublicKey) error {
if len(signatures) < 1 {
return ErrInsufficientSignatures{
Name: fmt.Sprintf(
"Cryptoservice failed to produce any signatures for keys with IDs: %v",
"cryptoservice failed to produce any signatures for keys with IDs: %v",
ids),
}
}

View File

@ -4,7 +4,6 @@ import (
"crypto/rand"
"crypto/x509"
"encoding/pem"
"errors"
"io"
"testing"
@ -55,7 +54,7 @@ func (mts *FailingCryptoService) GetPrivateKey(keyID string) (data.PrivateKey, s
if mts.testKey != nil {
return mts.testKey, "testRole", nil
}
return nil, "", errors.New("Key not found " + keyID)
return nil, "", trustmanager.ErrKeyNotFound{KeyID: keyID}
}
func (mts *FailingCryptoService) RemoveKey(keyID string) error {