Skip to content

Commit

Permalink
Merge pull request #17 from platacard/fix-encryption-cert-fingerprint
Browse files Browse the repository at this point in the history
Enable setting encryption certificate fingerprint field
  • Loading branch information
karen-avetisyan-mc authored Jul 19, 2024
2 parents 4b88eb0 + 1f7f25b commit d0a3efd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import github.com/mastercard/client-encryption-go
```

### Loading the Encryption Certificate <a name="loading-the-encryption-certificate"></a>
A `Certificate` can be created by calling the `utils.LoadSigningKey` function:
A `Certificate` can be created by calling the `utils.LoadEncryptionCertificate` function:
```go
import "github.com/mastercard/client-encryption-go/utils"

Expand Down Expand Up @@ -302,7 +302,7 @@ import "github.com/mastercard/client-encryption-go/field_level_encryption"

cb := field_level_encryption.NewFieldLevelEncryptionConfigBuilder()
config, err := cb.WithDecryptionKey(decryptionKey).
WithCertificate(encryptionCertificate).
WithEncryptionCertificate(encryptionCertificate).
WithEncryptionPath("$.path.to.foo", "$.path.to.encryptedFoo").
WithDecryptionPath("$.path.to.encryptedFoo.encryptedData", "$.path.to.foo").
WithEncryptedValueFieldName("encryptedData").
Expand Down
4 changes: 4 additions & 0 deletions mastercard_encryption/mastercard_encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func encryptPayloadPath(jsonPayload *gabs.Container, jsonPathIn string, jsonPath
encryptedObject.Set(params.EncryptedKeyValue, config.GetEncryptedKeyFieldName())
}

if !utils.IsNullOrEmpty(config.GetEncryptionCertificateFingerprintFieldName()) {
encryptedObject.Set(config.GetEncryptionCertificateFingerprint(), config.GetEncryptionCertificateFingerprintFieldName())
}

if !utils.IsNullOrEmpty(config.GetEncryptionKeyFingerprintFieldName()) {
encryptedObject.Set(config.GetEncryptionKeyFingerprint(), config.GetEncryptionKeyFingerprintFieldName())
}
Expand Down

0 comments on commit d0a3efd

Please sign in to comment.