mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 04:16:31 +02:00
rekey: added check to ensure that length of PGP keys and the shares are matching
This commit is contained in:
parent
3754d68d44
commit
42cff07157
@ -350,6 +350,11 @@ func (c *Core) BarrierRekeyUpdate(key []byte, nonce string) (*RekeyResult, error
|
||||
}
|
||||
|
||||
if len(c.barrierRekeyConfig.PGPKeys) > 0 {
|
||||
if len(results.SecretShares) != len(c.barrierRekeyConfig.PGPKeys) {
|
||||
c.logger.Error(fmt.Sprintf("core: mismatch between the number of PGP keys %q and the number of shares %q", len(c.barrierRekeyConfig.PGPKeys), len(results.SecretShares)))
|
||||
return nil, fmt.Errorf("mismatch between the number of PGP keys %q and the number of shares %q", len(c.barrierRekeyConfig.PGPKeys), len(results.SecretShares))
|
||||
}
|
||||
|
||||
hexEncodedShares := make([][]byte, len(results.SecretShares))
|
||||
for i, _ := range results.SecretShares {
|
||||
hexEncodedShares[i] = []byte(hex.EncodeToString(results.SecretShares[i]))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user