Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change encryption/decryption algorithm to A256CBC #177

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Azure/go-autorest/autorest v0.9.0
github.com/Azure/go-autorest/autorest/date v0.2.0
github.com/google/uuid v1.3.0
github.com/microsoft/moc v0.11.0-alpha.28
github.com/microsoft/moc v0.11.0-alpha.29
google.golang.org/grpc v1.54.0
k8s.io/klog v1.0.0
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
github.com/microsoft/moc v0.11.0-alpha.28 h1:cdMgpkoyn937QZZMZ5NmYYAUHlonkeHw4vgeIPvZoKQ=
github.com/microsoft/moc v0.11.0-alpha.28/go.mod h1:EuYNwYdC667rnJSYcLcLHKTuQURy9GLm7n+SMDhK6ps=
github.com/microsoft/moc v0.11.0-alpha.29 h1:SXqPMIXXdYlM5o3qlLU/cUf5kTByg/n8VWMMJ+Ls2bM=
github.com/microsoft/moc v0.11.0-alpha.29/go.mod h1:EuYNwYdC667rnJSYcLcLHKTuQURy9GLm7n+SMDhK6ps=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down
2 changes: 2 additions & 0 deletions services/security/keyvault/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ func getMOCAlgorithm(algo keyvault.JSONWebKeyEncryptionAlgorithm) (wssdcloudcomm
return wssdcloudcommon.Algorithm_RSAOAEP256, nil
case keyvault.A256KW:
ganeshamohana marked this conversation as resolved.
Show resolved Hide resolved
return wssdcloudcommon.Algorithm_A256KW, nil
case keyvault.A256CBC:
return wssdcloudcommon.Algorithm_A256CBC, nil
}
return wssdcloudcommon.Algorithm_A_UNKNOWN, errors.Wrapf(errors.InvalidInput, "Invalid Algorithm [%s]", algo)
}
Expand Down
4 changes: 3 additions & 1 deletion services/security/keyvault/keyvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ const (
RSAOAEP256 JSONWebKeyEncryptionAlgorithm = "RSA-OAEP-256"
// A256KW AES Key Wrap with 256 bit key-encryption key
A256KW JSONWebKeyEncryptionAlgorithm = "A256KW"
// A256CBC AES-CBC with 256 bit encryption key
A256CBC JSONWebKeyEncryptionAlgorithm = "A256CBC"
)

// KeyOperationsParameters the key operations parameters.
type KeyOperationsParameters struct {
// Algorithm - algorithm identifier. Possible values include: 'RSAOAEP', 'RSAOAEP256', 'RSA15', 'A256KW'
// Algorithm - algorithm identifier. Possible values include: 'RSAOAEP', 'RSAOAEP256', 'RSA15', 'A256KW', "A256CBC"
Algorithm JSONWebKeyEncryptionAlgorithm `json:"alg,omitempty"`
// Value - a URL-encoded base64 string
Value *string `json:"value,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions wrapper/cpp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func KeyvaultKeyEncryptDataCV(serverName *C.char, groupName *C.char, keyvaultNam

parameters := &keyvault.KeyOperationsParameters{
Value: &value,
Algorithm: keyvault.A256KW,
Algorithm: keyvault.A256CBC,
}

response, err := keyClient.Encrypt(ctx, C.GoString(groupName), C.GoString(keyvaultName), C.GoString(keyName), parameters)
Expand Down Expand Up @@ -125,7 +125,7 @@ func KeyvaultKeyDecryptDataCV(serverName *C.char, groupName *C.char, keyvaultNam

parameters := &keyvault.KeyOperationsParameters{
Value: &value,
Algorithm: keyvault.A256KW,
Algorithm: keyvault.A256CBC,
}

response, err := keyClient.Decrypt(ctx, C.GoString(groupName), C.GoString(keyvaultName), C.GoString(keyName), parameters)
Expand Down