Skip to content

PHPLIB-1375: Test KMIP "delegated" protocol #1358

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

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions tests/SpecTests/client-side-encryption/tests/azureKMS.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
"bsonType": "string",
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
}
},
"encrypted_string_kmip_delegated": {
"encrypt": {
"keyId": [
{
"$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6"
}
],
"bsonType": "string",
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
}
}
},
"bsonType": "object"
Expand Down
11 changes: 11 additions & 0 deletions tests/SpecTests/client-side-encryption/tests/gcpKMS.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
"bsonType": "string",
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
}
},
"encrypted_string_kmip_delegated": {
"encrypt": {
"keyId": [
{
"$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6"
}
],
"bsonType": "string",
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
}
}
},
"bsonType": "object"
Expand Down
139 changes: 139 additions & 0 deletions tests/SpecTests/client-side-encryption/tests/kmipKMS.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
"bsonType": "string",
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
}
},
"encrypted_string_kmip_delegated": {
"encrypt": {
"keyId": [
{
"$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6"
}
],
"bsonType": "string",
"algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic"
}
}
},
"bsonType": "object"
Expand Down Expand Up @@ -117,6 +128,38 @@
"altname",
"kmip_altname"
]
},
{
"_id": {
"$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6"
},
"keyMaterial": {
"$binary": {
"base64": "5TLMFWlguBWe5GUESTvOVtkdBsCrynhnV72XRyZ66/nk+EP9/1oEp1t1sg0+vwCTqULHjBiUE6DRx2mYD/Eup1+u2Jgz9/+1sV1drXeOPALNPkSgiZiDbIb67zRi+wTABEcKcegJH+FhmSGxwUoQAiHCsCbcvia5P8tN1lt98YQ=",
"subType": "00"
}
},
"creationDate": {
"$date": {
"$numberLong": "1634220190041"
}
},
"updateDate": {
"$date": {
"$numberLong": "1634220190041"
}
},
"status": {
"$numberInt": "0"
},
"masterKey": {
"provider": "kmip",
"delegated": true,
"keyId": "11"
},
"keyAltNames": [
"delegated"
]
}
],
"tests": [
Expand Down Expand Up @@ -218,6 +261,102 @@
]
}
}
},
{
"description": "Insert a document with auto encryption using KMIP delegated KMS provider",
"clientOptions": {
"autoEncryptOpts": {
"kmsProviders": {
"kmip": {}
}
}
},
"operations": [
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 1,
"encrypted_string_kmip_delegated": "string0"
}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"listCollections": 1,
"filter": {
"name": "default"
}
},
"command_name": "listCollections"
}
},
{
"command_started_event": {
"command": {
"find": "datakeys",
"filter": {
"$or": [
{
"_id": {
"$in": [
{
"$uuid": "7411e9af-c688-4df7-8143-5e60ae96cba6"
}
]
}
},
{
"keyAltNames": {
"$in": []
}
}
]
},
"$db": "keyvault"
},
"command_name": "find"
}
},
{
"command_started_event": {
"command": {
"insert": "default",
"documents": [
{
"_id": 1,
"encrypted_string_kmip_delegated": {
"$binary": {
"base64": "AXQR6a/GiE33gUNeYK6Wy6YCkB+8NVfAAjIbvLqyXIg6g1a8tXrym92DPoqmxpcdQyH0vQM3aFNMz7tZwQBimKs29ztZV/LWjM633HhO5ACl9A==",
"subType": "06"
}
}
}
],
"ordered": true
},
"command_name": "insert"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"encrypted_string_kmip_delegated": {
"$binary": {
"base64": "AXQR6a/GiE33gUNeYK6Wy6YCkB+8NVfAAjIbvLqyXIg6g1a8tXrym92DPoqmxpcdQyH0vQM3aFNMz7tZwQBimKs29ztZV/LWjM633HhO5ACl9A==",
"subType": "06"
}
}
}
]
}
}
}
]
}
4 changes: 2 additions & 2 deletions tests/SpecTests/client-side-encryption/tests/timeoutMS.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@
"failPoint": {
"configureFailPoint": "failCommand",
"mode": {
"times": 3
"times": 2
},
"data": {
"failCommands": [
"listCollections",
"find"
],
"blockConnection": true,
"blockTimeMS": 20
"blockTimeMS": 30
}
},
"clientOptions": {
Expand Down
64 changes: 64 additions & 0 deletions tests/UnifiedSpecTests/client-side-encryption/createDataKey.json
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,70 @@
}
]
},
{
"description": "create datakey with KMIP delegated KMS provider",
"operations": [
{
"name": "createDataKey",
"object": "clientEncryption0",
"arguments": {
"kmsProvider": "kmip",
"opts": {
"masterKey": {
"delegated": true
}
}
},
"expectResult": {
"$$type": "binData"
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"databaseName": "keyvault",
"command": {
"insert": "datakeys",
"documents": [
{
"_id": {
"$$type": "binData"
},
"keyMaterial": {
"$$type": "binData"
},
"creationDate": {
"$$type": "date"
},
"updateDate": {
"$$type": "date"
},
"status": {
"$$exists": true
},
"masterKey": {
"provider": "kmip",
"keyId": {
"$$type": "string"
},
"delegated": true
}
}
],
"writeConcern": {
"w": "majority"
}
}
}
}
]
}
]
},
{
"description": "create datakey with local KMS provider",
"operations": [
Expand Down
Loading