用于aws的加密原语

murmuration的Python项目详细描述


杂音

Build Status 用于AWS KMS的加密原语

AES+Galois计数器模式加密

frommurmurationimportgcmkey='this is my secret encryption key'plaintext='the quick brown fox jumps over the lazy dog'ciphertext=gcm.encrypt(plaintext,key,'header')decrypted=gcm.decrypt(ciphertext,key)assertdecrypted==plaintext

使用KMS加密(用于AWS)

您还可以将kms用作加密/解密服务。这是真的 产生KMS成本并要求设置KMS。regionprofile参数 不必指定。如果未指定这些值,则 推断出in the order specified by boto3

  1. Passing credentials as parameters in the boto.client() method
  2. Passing credentials as parameters when creating a Session object
  3. Environment variables
  4. Shared credential file (~/.aws/credentials)
  5. AWS config file (~/.aws/config)
  6. Assume Role provider
  7. Boto2 config file (/etc/boto.cfg and ~/.boto)
  8. Instance metadata service on an Amazon EC2 instance that has an IAM role configured.
frommurmurationimportkmsplaintext='the quick brown fox jumps over the lazy dog'key_alias='my kms key alias'ciphertext=kms.encrypt(plaintext,key_alias,region='us-west-1',profile='company')decrypted=kms.decrypt(ciphertext,region='us-west-1',profile='company')assertdecrypted==plaintext

使用KMS包装加密(用于AWS)

您还可以使用包装的KMS数据密钥进行加密,以保护底层 KMS键。使用此Does功能将产生KMS成本并需要KMS 设置。无需指定regionprofile参数。
如果未指定这些值,则 推断出in the order specified by boto3

  1. Passing credentials as parameters in the boto.client() method
  2. Passing credentials as parameters when creating a Session object
  3. Environment variables
  4. Shared credential file (~/.aws/credentials)
  5. AWS config file (~/.aws/config)
  6. Assume Role provider
  7. Boto2 config file (/etc/boto.cfg and ~/.boto)
  8. Instance metadata service on an Amazon EC2 instance that has an IAM role configured.
frommurmurationimportkms_wrappedplaintext='the quick brown fox jumps over the lazy dog'key_alias='my kms key alias'ciphertext=kms_wrapped.encrypt(plaintext,key_alias,region='us-west-1',profile='company')decrypted=kms_wrapped.decrypt(ciphertext,region='us-west-1',profile='company')assertdecrypted==plaintext

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
json到bson转换中的java性能问题   java设置一个内部接口。用于GUI的txt文件,并从中检索文本。txt文件   java Android系统GUI事件监听器   java此方法必须返回int类型的结果?   xmpp中无法识别java登录方法   java这个伞状异常的原因是什么   JAVA木卫一。IOException:无法删除原始文件   java找出循环依赖项的路径   排序java ArrayList合并排序   java使用StAX读取所有文本元素   java规则可能会被忽略   java如何在Arraylist中查找具有多个属性的对象?   java RecyclerView行在插入项目时闪烁/闪烁   java在表中选择行时更改文本框中的文本