Skip to content

1.1.58

Choose a tag to compare

@github-actions github-actions released this 21 Jul 09:42
· 51 commits to master since this release
feat(encrypt): Add DES/DESede IV and enhance RSA key generation

This commit introduces several changes to the SIKEncrypt and sample app:

**SIKEncrypt:**
- **IV for DES/DESede:** The `IEncryptConfig.iv()` method now generates an 8-byte IV for DES and DESede algorithms, and a 16-byte IV for AES.
- **RSA Key Generation:** In `RSAEncrypt`, `generateKeyPair()` now only throws an exception for invalid public key size if a public key is actually provided and its size is not 1024, 2048, or 4096.
- **RSA Private Key Check:** The `decrypt` method in `RSAEncrypt` now correctly checks if both the configured private key and the instance's private key are empty before throwing a `PRIVATE_KEY_NOT_SET` exception.

**Sample App:**
- **BaseActivity:** A new `BaseActivity` class is introduced to provide common functionality for activities, including view binding and a logger instance.
- **EncryptorActivity:**
    - A new `EncryptorActivity` is added to demonstrate encryption and decryption.
    - It uses `DESede` with `CBC` mode for demonstration.
    - UI elements for input, encrypt, decrypt, and displaying results are included.
- **MainActivity:**
    - Now extends `BaseActivity`.
    - An entry for "加解密实例" (Encryption/Decryption Example) is added, launching `EncryptorActivity`.
- **EncryptorRSAECBConfig:** A new configuration class `EncryptorRSAECBConfig` for RSA with ECB mode is added (currently with empty key placeholders).
- **EncryptorCBCConfig:** Changed the algorithm from `SM4` to `DESede` and updated the key.
- **build.gradle (app):** Enabled `viewBinding`.
- **AndroidManifest.xml:**
    - `resizeableActivity` attribute is set to `true` for the application.
    - `EncryptorActivity` is registered.
- **New Layout:** `activity_encryptor.xml` is added for the `EncryptorActivity` UI.

**SIKAndroid:**
- **ToastExt:** A new extension function `Context.toast(message: String)` is added for easily showing toasts.