Unable to Decrypt Data using CSFLE through MongoShell - HMAC Failed


We are currently testing Mongo CSFLE using C++ for our project. We’re using MongoDB 4.4 version. Previously, we faced challenges while encrypting data with CSFLE in C++ Code. Now, we want to decrypt the latest encrypted data through Mongo Shell. However, we are facing the error HMAC data authentication failed. We’re using the right Customer Master Key & Data Encryption Key as we’ve cross checked.

We’re storing the Master Key locally and importing it into Mongo Shell Environment using command mongo --eval "var LOCAL_KEY = '$MASTER_KEY'" --shell -u Admin

Defined autoEncryptionOpts as

var autoEncryptionOpts =  
        "keyVaultNamespace" : "keyvault.datakeys",
                "bypassAutoEncryption" : true,
                "kmsProviders" : { "local" : { "key" : BinData(0, LOCAL_KEY) } }

When we query the encrypted Collection using the MongoClient with CSFLE options only. We’re getting this


And, we’re able to decrypt the documents from Code. Unable to do it via Mongo Shell.
Please look into it and help us to solve this issue.

@Pavel_Duchovny Could you please look into this and help us out.?

What was the solution for this ?