Skip to content

Commit

Permalink
Rename transit key type constants (spiffe#5058)
Browse files Browse the repository at this point in the history
  • Loading branch information
InverseIntegral committed Aug 22, 2024
1 parent 2a920d1 commit 3dc796e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@ func (p *Plugin) createKey(ctx context.Context, spireKeyID string, keyType keyma
func convertToTransitKeyType(keyType keymanagerv1.KeyType) (*TransitKeyType, error) {
switch keyType {
case keymanagerv1.KeyType_EC_P256:
return to.Ptr(TransitKeyType_ECDSA_P256), nil
return to.Ptr(TransitKeyTypeECDSAP256), nil
case keymanagerv1.KeyType_EC_P384:
return to.Ptr(TransitKeyType_ECDSA_P384), nil
return to.Ptr(TransitKeyTypeECDSAP384), nil
case keymanagerv1.KeyType_RSA_2048:
return to.Ptr(TransitKeyType_RSA_2048), nil
return to.Ptr(TransitKeyTypeRSA2048), nil
case keymanagerv1.KeyType_RSA_4096:
return to.Ptr(TransitKeyType_RSA_4096), nil
return to.Ptr(TransitKeyTypeRSA4096), nil
default:
return nil, status.Errorf(codes.Internal, "unsupported key type: %v", keyType)
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/server/plugin/keymanager/hashicorpvault/vault_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,10 @@ func (c *Client) LookupSelf(token string) (*vapi.Secret, error) {
type TransitKeyType string

const (
TransitKeyType_RSA_2048 TransitKeyType = "rsa-2048"
TransitKeyType_RSA_4096 TransitKeyType = "rsa-4096"
TransitKeyType_ECDSA_P256 TransitKeyType = "ecdsa-p256"
TransitKeyType_ECDSA_P384 TransitKeyType = "ecdsa-p384"
TransitKeyTypeRSA2048 TransitKeyType = "rsa-2048"
TransitKeyTypeRSA4096 TransitKeyType = "rsa-4096"
TransitKeyTypeECDSAP256 TransitKeyType = "ecdsa-p256"
TransitKeyTypeECDSAP384 TransitKeyType = "ecdsa-p384"
)

type TransitHashAlgorithm string
Expand Down Expand Up @@ -390,7 +390,7 @@ func (c *Client) GetKey(ctx context.Context, spireKeyID string) (*vapi.Secret, e

func (c *Client) SignData(ctx context.Context, spireKeyID string, data string, hashAlgo TransitHashAlgorithm, signatureAlgo TransitSignatureAlgorithm) (*vapi.Secret, error) {
body := map[string]interface{}{
"key_version": "0",
"key_version": "0", // always use tha latest version
"input": data,
"signature_algorithm": signatureAlgo,
"marshalling_algorithm": "asn1",
Expand Down

0 comments on commit 3dc796e

Please sign in to comment.