Skip to content

Commit

Permalink
fix: Fix the issue of get_symmetric_cipher has wrong default value (f…
Browse files Browse the repository at this point in the history
…ixed #25)
  • Loading branch information
ZhuoZhuoCrayon committed Aug 16, 2023
1 parent e640562 commit aa05169
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bkcrypto/contrib/django/ciphers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_symmetric_cipher(
cipher_options: typing.Optional[typing.Dict[str, typing.Optional[SymmetricOptions]]] = None,
) -> BaseSymmetricCipher:
return ciphers.get_symmetric_cipher(
cipher_type=cipher_type or crypto_settings.ASYMMETRIC_CIPHER_TYPE,
cipher_type=cipher_type or crypto_settings.SYMMETRIC_CIPHER_TYPE,
common=common,
cipher_options=cipher_options,
symmetric_cipher_classes=crypto_settings.SYMMETRIC_CIPHER_CLASSES,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bk-crypto-python-sdk"
version = "1.1.0"
version = "1.1.1"
description = "bk-crypto-python-sdk is a lightweight cryptography toolkit for Python applications based on Cryptodome / tongsuopy and other encryption libraries."
authors = ["TencentBlueKing <[email protected]>"]
readme = "readme.md"
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ assert "123" == symmetric_cipher.decrypt(symmetric_cipher.encrypt("123"))
```python
from bkcrypto import constants
from bkcrypto.symmetric.options import AESSymmetricOptions, SM4SymmetricOptions
from bkcrypto.asymmetric.options import RSAAsymmetricOptions
from bkcrypto.asymmetric.options import RSAAsymmetricOptions, SM2AsymmetricOptions

BKCRYPTO = {
# 声明项目所使用的非对称加密算法
Expand Down Expand Up @@ -162,9 +162,9 @@ BKCRYPTO = {
"common": {"public_key_string": "your key"},
"cipher_options": {
constants.AsymmetricCipherType.RSA.value: RSAAsymmetricOptions(
padding=constants.RSACipherPadding.PKCS1_OAEP
padding=constants.RSACipherPadding.PKCS1_v1_5
),
constants.AsymmetricCipherType.SM2.value: SM4SymmetricOptions()
constants.AsymmetricCipherType.SM2.value: SM2AsymmetricOptions()
},
},
}
Expand Down
4 changes: 2 additions & 2 deletions readme_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Configure the encryption algorithm type in Django Settings
```python
from bkcrypto import constants
from bkcrypto.symmetric.options import AESSymmetricOptions, SM4SymmetricOptions
from bkcrypto.asymmetric.options import RSAAsymmetricOptions
from bkcrypto.asymmetric.options import RSAAsymmetricOptions, SM2AsymmetricOptions

BKCRYPTO = {
# Declare the asymmetric encryption algorithm used by the project
Expand Down Expand Up @@ -167,7 +167,7 @@ BKCRYPTO = {
constants.AsymmetricCipherType.RSA.value: RSAAsymmetricOptions(
padding=constants.RSACipherPadding.PKCS1_OAEP
),
constants.AsymmetricCipherType.SM2.value: SM4SymmetricOptions()
constants.AsymmetricCipherType.SM2.value: SM2AsymmetricOptions()
},
},
}
Expand Down
7 changes: 7 additions & 0 deletions release.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@

* [ Feature ] Add support for non-Django projects ([#19](https://github.com/TencentBlueKing/crypto-python-sdk/issues/19))
* [ Feature ] Add support for prefix ciphertext decryption ([#20](https://github.com/TencentBlueKing/crypto-python-sdk/issues/20))


## 1.1.1 - 2023-08-16

### Fixed

* [ Fixed ] Fix the issue of get_symmetric_cipher has wrong default value ([#25](https://github.com/TencentBlueKing/crypto-python-sdk/issues/25))

0 comments on commit aa05169

Please sign in to comment.