mirror of https://github.com/docker/docs.git
updating per Diogo's comments
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
parent
c08e732f9f
commit
05c5615187
|
|
@ -115,7 +115,7 @@ func (e *Ed25519) GetPrivateKey(keyID string) (data.PrivateKey, string, error) {
|
||||||
if k, ok := e.keys[keyID]; ok {
|
if k, ok := e.keys[keyID]; ok {
|
||||||
return k.privKey, k.role, nil
|
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
|
// ImportRootKey adds an Ed25519 key to the store as a root key
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ func Sign(service CryptoService, s *data.Signed, keys ...data.PublicKey) error {
|
||||||
privKeys[key.ID()] = k
|
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 {
|
if len(privKeys) == 0 {
|
||||||
return ErrNoKeys{keyIDs: ids}
|
return ErrNoKeys{keyIDs: ids}
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +68,7 @@ func Sign(service CryptoService, s *data.Signed, keys ...data.PublicKey) error {
|
||||||
if len(signatures) < 1 {
|
if len(signatures) < 1 {
|
||||||
return ErrInsufficientSignatures{
|
return ErrInsufficientSignatures{
|
||||||
Name: fmt.Sprintf(
|
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),
|
ids),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"errors"
|
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
|
@ -55,7 +54,7 @@ func (mts *FailingCryptoService) GetPrivateKey(keyID string) (data.PrivateKey, s
|
||||||
if mts.testKey != nil {
|
if mts.testKey != nil {
|
||||||
return mts.testKey, "testRole", 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 {
|
func (mts *FailingCryptoService) RemoveKey(keyID string) error {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue