mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	Update the error when no key can be found to a more clear error text (#2720)
This commit is contained in:
		 Brian Kassouf
					Brian Kassouf
				
			
				
					committed by
					
						 Jeff Mitchell
						Jeff Mitchell
					
				
			
			
				
	
			
			
			 Jeff Mitchell
						Jeff Mitchell
					
				
			
						parent
						
							958c4aeddd
						
					
				
				
					commit
					a51a0874b6
				
			| @@ -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) | ||||||
|   | |||||||
| @@ -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 { | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
| @@ -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 { | ||||||
|   | |||||||
| @@ -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 { | ||||||
|   | |||||||
| @@ -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) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user