bool encrypt instead of CipherOperation
enum (as used by Cipher) for the following reasons:
- Asymmetric ciphers only support two modes: encrypt or decrypt. The
CipherOperationenum was designed with potential future expansion for symmetric cipher modes.
- The key type already implies the operation: public keys encrypt, private keys decrypt.
The bool parameter serves as an explicit confirmation of intent rather than mode selection.
- Asymmetric operations are fundamentally different from symmetric streaming operations;
they process complete messages in one call via
process()rather thanupdate()/finish().
For new code requiring a unified interface, consider wrapping with an adapter that accepts CipherOperation and converts to bool internally.