forked from TrueCloudLab/certificates
Merge pull request #817 from Cpcrook/chore/#816-provisioner-decryption-error-messaging
Add descriptive provisioner JWK decryption error messages
This commit is contained in:
commit
588c72c046
1 changed files with 2 additions and 2 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue