Merge pull request #817 from Cpcrook/chore/#816-provisioner-decryption-error-messaging

Add descriptive provisioner JWK decryption error messages
This commit is contained in:
Mariano Cano 2022-02-07 10:14:36 -08:00 committed by GitHub
commit 588c72c046
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -155,11 +155,11 @@ func (p *Provisioner) SSHToken(certType, keyID string, principals []string) (str
func decryptProvisionerJWK(encryptedKey string, password []byte) (*jose.JSONWebKey, error) { func decryptProvisionerJWK(encryptedKey string, password []byte) (*jose.JSONWebKey, error) {
enc, err := jose.ParseEncrypted(encryptedKey) enc, err := jose.ParseEncrypted(encryptedKey)
if err != nil { if err != nil {
return nil, err return nil, errors.Wrap(err, "error parsing provisioner encrypted key")
} }
data, err := enc.Decrypt(password) data, err := enc.Decrypt(password)
if err != nil { if err != nil {
return nil, err return nil, errors.Wrap(err, "error decrypting provisioner key with provided password")
} }
jwk := new(jose.JSONWebKey) jwk := new(jose.JSONWebKey)
if err := json.Unmarshal(data, jwk); err != nil { if err := json.Unmarshal(data, jwk); err != nil {