π Enterprise Hybrid Encryption Library for Secure FinTech Application/Api
FintechEncryption is a lightweight .NET library that provides secure data encryption and decryption using Hybrid Cryptography.
It combines:
- π AES-256-GCM for fast symmetric encryption
- π RSA-2048 OAEP for secure key exchange
- βοΈ SHA256 Digital Signature for message integrity
This approach is widely used in banking systems, payment gateways, and fintech APIs.
β Hybrid Encryption (AES + RSA) β AES-256-GCM authenticated encryption β RSA-2048 OAEP key exchange β SHA256 Digital Signature verification β Secure random key generation β Lightweight and dependency minimal β Multi-framework support β Easy integration into existing APIs
This library supports multiple .NET frameworks:
| Framework | Supported |
|---|---|
| .NET Framework 4.8 | β |
| .NET Standard 2.0 | β |
| .NET 6 / 7 / 8 | β |
| ASP.NET MVC | β |
| ASP.NET Core | β |
| Console Applications | β |
Install via NuGet Package Manager
Install-Package FintechEncryption
or using .NET CLI
dotnet add package FintechEncryption
The library follows industry-standard cryptographic practices:
| Component | Algorithm |
|---|---|
| Data Encryption | AES-256-GCM |
| Key Exchange | RSA-2048 OAEP |
| Signature | SHA256withRSA |
| Random Generation | SecureRandom |
A common real-world scenario is secure communication between two systems, such as:
- π¦ Bank β Payment Gateway
- π’ FinTech Platform β Partner API
- π Merchant System β Payment Processor
Each system generates its own RSA key pair, then exchanges public keys to enable secure encrypted communication.
Each system generates its own RSA key pair.
var systemAKeys = KeyGenerator.GenerateRSAKeys();
string systemAPublicKey = systemAKeys.PublicKey;
string systemAPrivateKey = systemAKeys.PrivateKey;var systemBKeys = KeyGenerator.GenerateRSAKeys();
string systemBPublicKey = systemBKeys.PublicKey;
string systemBPrivateKey = systemBKeys.PrivateKey;Both systems securely exchange public keys.
| System | Shares | Keeps Secret |
|---|---|---|
| System A | Public Key | Private Key |
| System B | Public Key | Private Key |
Example:
System A β sends PublicKeyA to System B
System B β sends PublicKeyB to System A
Private keys must never be shared.
System A encrypts the payload using:
- its private key (for signing)
- System B's public key (for encrypting AES key)
var encryptionService = new EncryptionService();
string encryptedPayload = encryptionService.EncryptData(
plainTextData,
systemAPrivateKey,
systemBPublicKey
);Encrypted data can now be sent over:
- REST APIs
- Message queues
- Webhooks
- Secure channels
System B decrypts the message using:
- its private key (to decrypt AES key)
- System A's public key (to verify signature)
var decryptionService = new DecryptionService();
string decryptedPayload = decryptionService.DecryptData(
encryptedData,
systemBPrivateKey,
systemAPublicKey
);System B can now safely process the data.
This hybrid encryption model provides:
| Security Property | Description |
|---|---|
| π Confidentiality | Only the receiver can decrypt the message |
| βοΈ Integrity | Message cannot be altered without detection |
| π€ Authentication | Confirms the sender's identity |
| π Secure Key Exchange | AES key protected by RSA |
System A System B
--------- ---------
Generate KeyPair A Generate KeyPair B
PublicKeyA --------------------> PublicKeyA received
PublicKeyB <-------------------- PublicKeyB shared
Encrypt using:
PrivateKeyA + PublicKeyB
Encrypted Payload -------------> Receive Payload
Decrypt using:
PrivateKeyB + PublicKeyA
The payload is encrypted before transmission to ensure high-level API security.
FinTechEncryption uses a custom exception EncryptionException for all encryption and decryption related errors.
Applications using the library should catch this exception to safely handle failures.
using FinTechEncryption;
try
{
var decryptionService = new DecryptionService();
string decrypted = decryptionService.DecryptData(
encrypted,
receiverPrivateKey,
senderPublicKey
);
Console.WriteLine("Decrypted Data: " + decrypted);
}
catch (EncryptionException ex)
{
Console.WriteLine("Encryption operation failed: " + ex.Message);
}
catch(Exception e)
{
Console.WriteLine("Exception Error: " + e.Message);
}Use FintechEncryption when building:
- FinTech APIs
- Payment gateway integrations
- Secure partner APIs
- Banking systems
- Sensitive data exchange services
- Enterprise API platforms
Contributions are welcome!
Steps:
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a Pull Request
This project is licensed under the MIT License.
If you find this project useful:
β Star the repository π Report issues π‘ Suggest improvements
dotnet encryption
hybrid encryption
aes rsa encryption
fintech security
secure api encryption
api payload encryption