You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.