- Notifications
You must be signed in to change notification settings - Fork 10
mastercard encryption #6
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
mastercard encryption #6
Conversation
field_level_encryption/field_level_encryption_config_builder.go Outdated Show resolved Hide resolved
| Hi @mateusmrangel, Thanks for creating this PR! There are a couple of things that will need to be added before we can merge this PR.
If you have any questions, please feel free to reach out! |
Ok, I am going to work on it |
| encryptedPayload := EncryptPayload(payload, flConfig, params) | ||
| fmt.Println(encryptedPayload) | ||
| | ||
| decryptedPayload := DecryptPayload(encryptedPayload, flConfig, params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'params' for decrypting the payload should be extracted from the actual request body/headers as they are in our other libraries.
| func Generate(config *FieldLevelEncryptionConfig) *FieldLevelEncryptionParams { | ||
| //// Generate a random IV | ||
| ivParameterSpec := aes_encryption.GenerateCEK(16 * 8) | ||
| ivSpecValue := utils.HexUrlEncode(ivParameterSpec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our other libraries (Java for example), we allow the user to specify the FieldValueEncoding through the config. In your implementation it's hard coded to always use Hex.
| return jsonPayload.String() | ||
| } | ||
| | ||
| func decryptPayloadPath(jsonPayload *gabs.Container, jsonPathIn string, jsonPathOut string, params *field_level_encryption.FieldLevelEncryptionParams) *gabs.Container { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'jsonPathOut' isn't used in this function. This property should be used to include the encrypted payload in a specific path in the payload (See the Java encryption library)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our other libraries, it's possible to include the encryption properties in the header of a request/response. You can see this functionality in the Java library for reference.
The functionality for this library should be identical to all of our other libraries.
You can include all the tests that are in our Java encryption library to ensure you're covering all possible cases.
| Addressing this PR in the following PR: #14 |
Hello everyone
With this merge request, the lib will support MasterCard encryption. See the usage on the mastercard_encryption/mastercard_encryption_test.go file.
I used as a base the Java implementation of the client-encryption library