Skip to content

Commit

Permalink
Fix-383 destroyed key gcp (#384)
Browse files Browse the repository at this point in the history
* fix-383 destroyed key gcp - only fetch pk for enabled version

* remove unreachable code
  • Loading branch information
stephengaudet committed Jul 3, 2023
1 parent 397faf9 commit 7d22b8d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions pkg/vault/cloudkms/cloudkms.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,16 @@ func (c *cloudKMSIterator) Next() (vault.StoredKey, error) {
// get key versions
c.verIter = c.vault.client.ListCryptoKeyVersions(c.ctx, &kmspb.ListCryptoKeyVersionsRequest{Parent: key.Name})
} else {
pub, err := c.vault.getPublicKey(c.ctx, ver.Name)
if err != nil {
return nil, fmt.Errorf("(CloudKMS/%s) getPublicKey: %w", c.vault.config.keyRingName(), err)
}
if err != nil {
if err != crypt.ErrUnsupportedKeyType {
if ver.State == kmspb.CryptoKeyVersion_ENABLED {
pub, err := c.vault.getPublicKey(c.ctx, ver.Name)
if err != nil {
return nil, fmt.Errorf("(CloudKMS/%s) getPublicKey: %w", c.vault.config.keyRingName(), err)
} else {
return &cloudKMSKey{
key: ver,
pub: pub,
}, nil
}
} else {
return &cloudKMSKey{
key: ver,
pub: pub,
}, nil
}
}
}
Expand Down

0 comments on commit 7d22b8d

Please sign in to comment.