简体   繁体   English

如何使用字段级加密在 Pymongo 中获取 KeyByAltName?

[英]How can you getKeyByAltName in Pymongo using Field Level Encryption?

I have been trying to get the keys I have generated with this repo https://github.com/mongodb-developer/python-quickstart-code and it is really useful for creating keys in python, however how do you get a key for an altname?我一直在尝试获取使用此存储库生成的密钥https://github.com/mongodb-developer/python-quickstart-code它对于在 python 中创建密钥非常有用,但是如何获取密钥别名?

I thought perhaps it is best to try running commands like: db.command("getKeyByAltName", keyAltName="nameofkeyaltnameadmin") but I get the error getKeyByAltName does not exist:我认为也许最好尝试运行如下命令: db.command("getKeyByAltName", keyAltName="nameofkeyaltnameadmin")但我收到错误 getKeyByAltName 不存在:

pymongo.errors.OperationFailure: no such command: 'getKeyByAltName', full error: {'ok': 0.0, 'errmsg': "no such command: 'getKeyByAltName'", 'code': 59, 'codeName': 'CommandNotFound'}

even though it definitely does according to the docs https://www.mongodb.com/docs/v4.2/reference/method/KeyVault.getKeyByAltName/ can anyone help me with this?即使它确实根据文档https://www.mongodb.com/docs/v4.2/reference/method/KeyVault.getKeyByAltName/谁能帮我解决这个问题? I am a bit stuck...我有点卡住了...

My mongodb version is:我的 mongodb 版本是:

db version v6.0.3
Build Info: {
    "version": "6.0.3",
    "gitVersion": "f803681c3ae19817d31958965850193de067c516",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "windows",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

getKeyByAltName is a method of a KeyVault object. getKeyByAltName是 KeyVault 对象的一种方法。 It is a client-side field level encryption method.它是一种客户端字段级加密方法。

db.command is for running database commands on the server. db.command用于在服务器上运行数据库命令

This method should be in a ClientEncryption object (see for example a test here ), I'm not a python developer, but getKeyByAltName should be there此方法应该在 ClientEncryption 对象中(例如,参见此处的测试),我不是 python 开发人员,但 getKeyByAltName 应该在那里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM