Update the error when no key can be found to a more clear error text (#2720)

This commit is contained in:
Brian Kassouf
2017-05-12 11:14:00 -07:00
committed by Jeff Mitchell
parent 958c4aeddd
commit a51a0874b6
6 changed files with 8 additions and 8 deletions

View File

@@ -97,7 +97,7 @@ func (b *backend) pathDatakeyWrite(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
newKey := make([]byte, 32) newKey := make([]byte, 32)

View File

@@ -119,7 +119,7 @@ func (b *backend) pathDecryptWrite(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
for i, item := range batchInputItems { for i, item := range batchInputItems {

View File

@@ -233,7 +233,7 @@ func (b *backend) pathEncryptWrite(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
// Process batch request items. If encryption of any request // Process batch request items. If encryption of any request

View File

@@ -79,7 +79,7 @@ func (b *backend) pathHMACWrite(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
key, err := p.HMACKey(p.LatestVersion) key, err := p.HMACKey(p.LatestVersion)
@@ -162,7 +162,7 @@ func (b *backend) pathHMACVerify(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
if ver > p.LatestVersion { if ver > p.LatestVersion {

View File

@@ -113,7 +113,7 @@ func (b *backend) pathRewrapWrite(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
for i, item := range batchInputItems { for i, item := range batchInputItems {

View File

@@ -145,7 +145,7 @@ func (b *backend) pathSignWrite(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
if !p.Type.SigningSupported() { if !p.Type.SigningSupported() {
@@ -222,7 +222,7 @@ func (b *backend) pathVerifyWrite(
return nil, err return nil, err
} }
if p == nil { if p == nil {
return logical.ErrorResponse("policy not found"), logical.ErrInvalidRequest return logical.ErrorResponse("encryption key not found"), logical.ErrInvalidRequest
} }
valid, err := p.VerifySignature(hashedInput, sig) valid, err := p.VerifySignature(hashedInput, sig)