python中的json web加密实现
PyJWE的Python项目详细描述
#pyjwe
[json web加密](https://tools.ietf.org/html/rfc7516)在python中的实现
[![PYPI版本](https://badge.fury.io/py/pyjwe.svg)(https://badge.fury.io/py/pyjwe)
[![构建状态](https://travis-ci.org/chrisseto/pyjwe.svg?(https://travis ci.org/chrisseto/pyjwe/pyjwe)
\基本用法
``python
>导入jwe
key=b'mysecretkey'b'mysecretkey'
>salt=b'peppeppepper'
>encoded=jwe.encrypt(b'supsecretdata'supsecretdata'supsecretetdata'supsecretretretdata',派生密钥)jwe key=jwe.kdf(key,salt)
jwe.解密(编码,导出的密钥)b'supersecretdata'
```
\faq
\kdf函数是什么?我应该用它吗?我必须用它吗?
`jwe.kdf`是一个非常简单的[密钥派生函数](https://en.wikipedia.org/wiki/key_derivation_function),它使用[PBKDF2](https://en.wikipedia.org/wiki/PBKDF2)。
对于AES256。
您不必使用它,但如果您不使用它,则密钥必须正好是256位。
因为[密钥包装](https://en.wikipedia.org/wiki/key悻wrap)或多或少[完全无用](https://security.stackexchange.com/questions/40052/when-do-i-use-nist-aes-key-wrapping)。
它满足了我的需要,我还需要其他方法。
如果您希望实现其他方法,请随时提交问题。
[json web加密](https://tools.ietf.org/html/rfc7516)在python中的实现
[![PYPI版本](https://badge.fury.io/py/pyjwe.svg)(https://badge.fury.io/py/pyjwe)
[![构建状态](https://travis-ci.org/chrisseto/pyjwe.svg?(https://travis ci.org/chrisseto/pyjwe/pyjwe)
\基本用法
``python
>导入jwe
key=b'mysecretkey'b'mysecretkey'
>salt=b'peppeppepper'
>encoded=jwe.encrypt(b'supsecretdata'supsecretdata'supsecretetdata'supsecretretretdata',派生密钥)jwe key=jwe.kdf(key,salt)
jwe.解密(编码,导出的密钥)b'supersecretdata'
```
\faq
\kdf函数是什么?我应该用它吗?我必须用它吗?
`jwe.kdf`是一个非常简单的[密钥派生函数](https://en.wikipedia.org/wiki/key_derivation_function),它使用[PBKDF2](https://en.wikipedia.org/wiki/PBKDF2)。
对于AES256。
您不必使用它,但如果您不使用它,则密钥必须正好是256位。
因为[密钥包装](https://en.wikipedia.org/wiki/key悻wrap)或多或少[完全无用](https://security.stackexchange.com/questions/40052/when-do-i-use-nist-aes-key-wrapping)。
它满足了我的需要,我还需要其他方法。
如果您希望实现其他方法,请随时提交问题。