MainLibProj_Hrithik 2.6.1
dotnet add package MainLibProj_Hrithik --version 2.6.1
NuGet\Install-Package MainLibProj_Hrithik -Version 2.6.1
<PackageReference Include="MainLibProj_Hrithik" Version="2.6.1" />
<PackageVersion Include="MainLibProj_Hrithik" Version="2.6.1" />
<PackageReference Include="MainLibProj_Hrithik" />
paket add MainLibProj_Hrithik --version 2.6.1
#r "nuget: MainLibProj_Hrithik, 2.6.1"
#:package MainLibProj_Hrithik@2.6.1
#addin nuget:?package=MainLibProj_Hrithik&version=2.6.1
#tool nuget:?package=MainLibProj_Hrithik&version=2.6.1
MainLibProj_Hrithik
A powerful, production-ready .NET utility library providing FIX protocol trading, JWT RSA decryption, and Azure & document utilities β all in one package.
π§± Installation
Install via NuGet Package Manager:
dotnet add package MainLibProj_Hrithik
Or using the Visual Studio Package Manager Console:
Install-Package MainLibProj_Hrithik
π New in v2.6.1:
- Updated internal and third-party dependencies
- No functional or breaking changes
- Improves security, stability, and compatibility
π MainLibProj_Hrithik β JWT RSA decryption (Latest Release)
π New in v2.6.0:
π Secure Transactions (JWS + JWE) β v2.6.0+
Recommended for new implementations
The Secure Transactions module introduces a banking-style, envelope-based security model for exchanging business payloads between services.
It is built on industry-standard JWT technologies:
JWS (RS256) for integrity and non-repudiation
JWE (RSA-OAEP + AES) for payload confidentiality
Time-bound tokens to mitigate replay attacks
Strongly-typed payload support
Clean separation of crypto and business logic
This approach is commonly used in banking, payment gateways, and financial middleware.
π How Secure Transactions Work
Business Object β JSON Serialization β JWE Encryption (Confidentiality) β Secure Envelope β JWS Signature (Integrity) β Transport (HTTP / Messaging)
β Secure Transaction β Usage Example
// Business payload var payload = new TestTransaction { TransactionId = "TX123", Amount = 5000, Currency = "INR" };
// Create secure token var token = secureService.CreateSecureRequest( payload, recipientPublicKey: serverPublicKey, senderPrivateKey: clientPrivateKey, options: new SecureTransactionOptions { Issuer = "bank-client", Audience = "payment-api", ExpiryMinutes = 5 });
// Validate and decrypt var result = secureService.DecryptAndValidate<TestTransaction>( token, senderPublicKey: clientPublicKey, recipientPrivateKey: serverPrivateKey);
Console.WriteLine(result.Data.TransactionId); Console.WriteLine(result.Data.Amount);
OLD PACKAGE SUMMARY FOR REVIEW:
π RSA Encrypted JWT Decryption & Decoding Support using AES to resolve encryption size issue in package 2.4.0
You can now encrypt and decrypt RSA tokens, encode-decode JWTs, and extract claims securely using a simple APIβwithout handling low-level cryptography.
β¨ JWT Feature Highlights
β Supports PKCS#1 RSA private keys
β Supports PKCS#1 RSA public keys for encryption
β Automatically encrypts + encode JWT
β Accepts Base64 encrypted tokens
β Automatically decrypts + decodes JWT
β Returns Raw JWT and Claims Dictionary
β Ideal for APIs, Azure Functions, APIM, Microservices
βοΈ How It Works
π JWT RSA ENCRYPTION β Usage Example
var payload = new JObject
{
["dealer_id"] = "",
["serial_no"] = "abc"
};
string publicKeyPem = @"
-----BEGIN PUBLIC KEY-----
l54QhuRz9Lb9tuE1DBvCFn/a0zfQTQdbfNsnplaNJwIDAQAB......
-----END PUBLIC KEY-----
";
var encryptor = new HybridJwtEncryptor(
publicKeyPem,
"a-string-secret-at-least-256-bits-long"
);
var encryptedPayload = encryptor.EncryptPayload(payload);
Console.WriteLine("Encrypted JWT:");
Console.WriteLine(encryptedPayload);
π JWT RSA ENCRYPTION β Usage Example
var decryptorkey ="-----BEGIN RSA PRIVATE KEY-----\r\nMIIAEz89ibQKJOOnit81zmxTP.................................pvlnviB9VeJWtBU6\r\n-----END RSA PRIVATE KEY-----";
var encryptedJson = @"{
""encryptedKey"": ""FWHzWE7mV84QuT7PmUp1j7/rPTgLMWoW9EfPCWhO08giwNkQLzlebVQBe71pifeSVBHeu4q6..................TVwGu3WjrH+y5ItyUWPCOtpiuhOh+Q=="",
""nonce"": ""1PksuW.........g2sgSg"",
""tag"": ""nmO+ln............Tw=="",
""cipherText"": ""eaaRbYvq6plPUNvpkvl4Ardcly6PpaJLredjFLiAA2X2eD3MyE064wTbi+gyd+K6ZiUBOJ+GfkvUQ/U5eNEvDIdn+.................................../aPnkq8Fu6kpcPOrk9Y7NbGxv3+KE3j5Mv5bvt7SSiD8AZQiTls+h""
}";
JObject encryptedPayloads = JObject.Parse(encryptedJson);
var decryptor = new HybridJwtDecryptor(decryptorkey);
var decryptedClaims = decryptor.Decrypt(encryptedPayloads);
Console.WriteLine(
Newtonsoft.Json.JsonConvert.SerializeObject(
decryptedClaims,
Newtonsoft.Json.Formatting.Indented
)
);
π§ Common Use Cases
Secure API-to-API authentication
Decrypting tokens from external identity providers
Azure Functions & APIM integrations
Enterprise microservice security flows
π FIX Protocol Support
π Introduced in v2.2.0
Integrated FIX protocol connectivity using QuickFIX/n directly into the library.
Send Equity, Fractional, Notional, Option, and Multi-Leg orders using simple JSON-based requestsβno FIX expertise required.
βοΈ How FIX Support Works
Handles FIX session lifecycle
Manages authentication & heartbeats
Builds and parses FIX messages internally
Exposes a clean JSON-based API
π§© Other Usage Example using MainLibProj_Hrithik.Fix; using System.Text.Json;
// Step 1: Configure FIX Connection var config = new FixConnectionConfig { // Required: Session identifiers SenderCompId = "", TargetCompId = "",
// Optional: Sub IDs
SenderSubId = "YOUR_SENDER_SUB_ID",
TargetSubId = "TARGET_SUB_ID",
// Optional: Authentication
Username = "YOUR_USERNAME",
Password = "YOUR_PASSWORD",
// Required: FIX configuration file path
FixSettingsFilePath = "path/to/fix.cfg",
// Certificate options
CertificatePath = "C:\\path\\to\\certificate.cer",
CertificatePassword = "cert_password_if_any",
// Connection settings
HostName = "your.fixserver.com",
Port = 12345,
ProxyPort = 15000,
HeartbeatInterval = 30,
ResponseTimeoutSeconds = 20
};
// Step 2: (Optional) Load certificate from Azure Key Vault var configWithKeyVault = new FixConnectionConfig { SenderCompId = "YOUR_SENDER_COMP_ID", TargetCompId = "FIX_TARGET_COMP_ID", Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD", FixSettingsFilePath = "path/to/fix.cfg",
// Azure Key Vault integration
KeyVaultUrl = "https://your-keyvault.vault.azure.net/",
CertificateName = "fixcert"
};
// Step 3: Initialize FIX Gateway Client using var client = new FixJsonGatewayClient(config, null); await client.InitializeAsync();
// Step 4: Send Orders await SendEquityOrder(client); await SendFractionalOrder(client); await SendOptionOrder(client); await SendMultiLegOrder(client); await CancelOrder(client); await ReplaceOrder(client);
π§Ύ Example: Send an Equity Order static async Task SendEquityOrder(FixJsonGatewayClient client) { Console.WriteLine("\n=== Sending Equity Order ===");
var request = new FixJsonRequest
{
MessageType = "NewOrderSingle",
Fields = new Dictionary<string, object>
{
{ "ClOrdID", "ORDER-" + Guid.NewGuid() },
{ "Symbol", "AAPL" },
{ "Side", "1" }, // Buy
{ "OrdType", "2" }, // Limit
{ "OrderQty", 100 },
{ "Price", 150.50 },
{ "Account", "YOUR_ACCOUNT_NUMBER" },
{ "TimeInForce", "0" }, // Day
{ "Currency", "USD" },
{ "SecurityType", "CS" }, // Common Stock
{ "ExDestination", "NASDAQ" },
{ "Rule80A", "I" } // Individual
}
};
var response = await client.SendMessageAsync(request);
Console.WriteLine($"Status: {response.Status}");
Console.WriteLine($"Response: {JsonSerializer.Serialize(response.Fields, new JsonSerializerOptions { WriteIndented = true })}");
if (response.Status == "Rejected")
Console.WriteLine($"Error: {response.ErrorMessage}");
}
π‘ Supported Order Types Type Method Equity SendEquityOrder() Fractional SendFractionalOrder() Option SendOptionOrder() Multi-Leg SendMultiLegOrder() Cancel CancelOrder() Replace ReplaceOrder() π Key Features
β Native QuickFIX/n integration
β Supports Azure Key Vault certificates
β JSON-based order structure for easy integration
β Plug-and-play FIX connectivity
β Built for Equity, Fractional, Notional, Option, and Multi-leg orders
π§ OTHER Usage Examples π¦ Upload File to Azure Blob Storage using MainLibProj_Hrithik.AzureHelpers;
var connectionString = "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=core.windows.net;"; var containerName = "uploads"; var filePath = "C:\Users\Hrithik\Documents\data.json";
await BlobHelper.UploadFileAsync(connectionString, containerName, filePath); Console.WriteLine("β File uploaded successfully!");
π Retrieve Secret from Azure Key Vault using MainLibProj_Hrithik.AzureHelpers;
var secretValue = await KeyVaultHelper.GetSecretAsync("https://myvault.vault.azure.net/", "StorageAccountKey"); Console.WriteLine($"π Secret value: {secretValue}");
π Convert Excel File to JSON using MainLibProj_Hrithik.Converters;
var excelFilePath = "C:\Data\Orders.xlsx"; var json = ExcelConverter.ConvertToJson(excelFilePath);
Console.WriteLine(json);
π Convert Word Document to PDF using MainLibProj_Hrithik.Converters;
var docxPath = "C:\Docs\Invoice.docx"; var pdfPath = "C:\Docs\Invoice.pdf";
WordToPdfConverter.Convert(docxPath, pdfPath); Console.WriteLine("π PDF created successfully!");
π§° Tech Stack
.NET 8.0
Azure SDK for .NET
OpenXML SDK
PdfSharpCore
Newtonsoft.Json
π License
MIT License
π€ Author
Hrithik Kalra
.NET | API Security | Fintech Systems
π§ Email: hrithikkalra11@gmail.com
GitHub: https://github.com/hrithikalra
LinkedIn: https://www.linkedin.com/in/hrithik-kalra-b6836a246/
If you find this package useful, consider supporting its development:
- β Buy Me a Coffee: https://www.buymeacoffee.com/alkylhalid9
- β€οΈ GitHub Sponsors: https://github.com/sponsors/hrithikalra
Support is entirely optional and helps sustain ongoing development and maintenance.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Azure.Identity (>= 1.17.1)
- Azure.Security.KeyVault.Certificates (>= 4.8.0)
- Azure.Security.KeyVault.Keys (>= 4.8.0)
- Azure.Security.KeyVault.Secrets (>= 4.8.0)
- Azure.Storage.Blobs (>= 12.27.0)
- ClosedXML (>= 0.105.0)
- DocumentFormat.OpenXml (>= 3.4.1)
- Microsoft.Extensions.Caching.Memory (>= 10.0.2)
- Microsoft.Extensions.Configuration (>= 10.0.2)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.2)
- Microsoft.Extensions.DependencyInjection (>= 10.0.2)
- Microsoft.Extensions.Options (>= 10.0.2)
- Newtonsoft.Json (>= 13.0.4)
- PdfSharpCore (>= 1.3.67)
- QuickFIXn.FIX42 (>= 1.14.0)
- SixLabors.ImageSharp (>= 3.1.12)
- System.IdentityModel.Tokens.Jwt (>= 8.15.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 2.6.1 | 109 | 2/11/2026 | |
| 2.6.0 | 124 | 1/28/2026 | |
| 2.5.0 | 111 | 1/22/2026 | |
| 2.4.0 | 104 | 1/22/2026 | |
| 2.3.0 | 103 | 1/21/2026 | |
| 2.2.0 | 278 | 11/14/2025 | |
| 2.1.6-Preview | 292 | 11/4/2025 | |
| 2.1.5-Preview | 271 | 11/4/2025 |
Maintenance release:
- Updated internal and third-party dependencies
- No functional or breaking changes