-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.16.x' into backport/ui/VAULT-20147/configurat…
…ion-link-list-view/totally-pleasing-bulldog
- Loading branch information
Showing
63 changed files
with
2,456 additions
and
582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
|
||
package pki | ||
|
||
import ( | ||
"crypto" | ||
"crypto/ecdsa" | ||
"crypto/ed25519" | ||
"crypto/elliptic" | ||
"crypto/rand" | ||
"crypto/rsa" | ||
"testing" | ||
|
||
"github.com/hashicorp/vault/sdk/helper/certutil" | ||
) | ||
|
||
func TestGetKeyTypeAndBitsFromPublicKeyForRole(t *testing.T) { | ||
rsaKey, err := rsa.GenerateKey(rand.Reader, 2048) | ||
if err != nil { | ||
t.Fatalf("error generating rsa key: %s", err) | ||
} | ||
|
||
ecdsaKey, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) | ||
if err != nil { | ||
t.Fatalf("error generating ecdsa key: %s", err) | ||
} | ||
|
||
publicKey, _, err := ed25519.GenerateKey(rand.Reader) | ||
if err != nil { | ||
t.Fatalf("error generating ed25519 key: %s", err) | ||
} | ||
|
||
testCases := map[string]struct { | ||
publicKey crypto.PublicKey | ||
expectedKeyType certutil.PrivateKeyType | ||
expectedKeyBits int | ||
expectError bool | ||
}{ | ||
"rsa": { | ||
publicKey: rsaKey.Public(), | ||
expectedKeyType: certutil.RSAPrivateKey, | ||
expectedKeyBits: 2048, | ||
}, | ||
"ecdsa": { | ||
publicKey: ecdsaKey.Public(), | ||
expectedKeyType: certutil.ECPrivateKey, | ||
expectedKeyBits: 0, | ||
}, | ||
"ed25519": { | ||
publicKey: publicKey, | ||
expectedKeyType: certutil.Ed25519PrivateKey, | ||
expectedKeyBits: 0, | ||
}, | ||
"bad key type": { | ||
publicKey: []byte{}, | ||
expectedKeyType: certutil.UnknownPrivateKey, | ||
expectedKeyBits: 0, | ||
expectError: true, | ||
}, | ||
} | ||
|
||
for name, tt := range testCases { | ||
t.Run(name, func(t *testing.T) { | ||
keyType, keyBits, err := getKeyTypeAndBitsFromPublicKeyForRole(tt.publicKey) | ||
if err != nil && !tt.expectError { | ||
t.Fatalf("unexpected error: %s", err) | ||
} | ||
if err == nil && tt.expectError { | ||
t.Fatal("expected error, got nil") | ||
} | ||
|
||
if keyType != tt.expectedKeyType { | ||
t.Fatalf("key type mismatch: expected %s, got %s", tt.expectedKeyType, keyType) | ||
} | ||
|
||
if keyBits != tt.expectedKeyBits { | ||
t.Fatalf("key bits mismatch: expected %d, got %d", tt.expectedKeyBits, keyBits) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
ui: Update PGP display and show error for Generate Operation Token flow with PGP | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
pki: Fix error in cross-signing using ed25519 keys | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:change | ||
ui/kubernetes: Update the roles filter-input to use explicit search. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:change | ||
core/identity: improve performance for secondary nodes receiving identity related updates through replication | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
secrets/transit: Use 'hash_algorithm' parameter if present in HMAC verify requests. Otherwise fall back to deprecated 'algorithm' parameter. | ||
``` |
Oops, something went wrong.