SimpleSecureData 1.0.0
dotnet add package SimpleSecureData --version 1.0.0
NuGet\Install-Package SimpleSecureData -Version 1.0.0
<PackageReference Include="SimpleSecureData" Version="1.0.0" />
paket add SimpleSecureData --version 1.0.0
#r "nuget: SimpleSecureData, 1.0.0"
// Install SimpleSecureData as a Cake Addin #addin nuget:?package=SimpleSecureData&version=1.0.0 // Install SimpleSecureData as a Cake Tool #tool nuget:?package=SimpleSecureData&version=1.0.0
🔒 SimpleSecureData
SimpleSecureData is a cross-platform library designed to enhance security by ensuring sensitive data remains encrypted in memory at all times. It leverages platform-specific secure storage mechanisms for optimal security and falls back to a custom AES-based encryption for unsupported platforms.
📖 Table of Contents
- 🚀 Features
- 💾 Platform-Specific Implementations
- 📦 Installation
- 📚 Usage Examples
- 🤝 Contributing
- 📜 License
🚀 Features
- Memory Encryption: All sensitive data is encrypted in memory using ChaCha20.
- Platform-Specific Secure Storage:
- Windows: DPAPI for secure local storage.
- Android: AndroidX EncryptedSharedPreferences.
- iOS: Keychain Services.
- Secure Data Types:
SecureBytes
: Securely manage byte arrays.SecureString
: A secure implementation for strings.SecureChar
: Handle individual characters securely.
- Cross-Platform Support: Supports Windows, Android, iOS, macOS, Linux, and more.
- Fallback Mechanism: AES-based encryption with HMAC for platforms without secure storage APIs.
- Flexible APIs:
- Serialize, deserialize, append, and split secure objects.
- Automatic memory cleanup with
CryptographicOperations.ZeroMemory
.
💾 Platform-Specific Implementations
Platform | Implementation |
---|---|
Windows | DPAPI (System.Security.Cryptography.ProtectedData ). |
Android | AndroidX EncryptedSharedPreferences with AES-256-GCM. |
iOS | Keychain Services for secure storage. |
Others | AES-256 encryption with HMAC for integrity verification (fallback). |
📦 Installation
Add the package to your project:
dotnet add package SimpleSecureData
Import the necessary namespaces:
using SimpleSecureData; using SimpleSecureData.Text;
📚 Usage Examples
SecureBytes
Securely store and manipulate byte arrays:
var secureBytes = new SecureBytes(new byte[] { 1, 2, 3, 4 });
secureBytes.AppendData(new byte[] { 5, 6, 7 });
byte[] plainBytes = secureBytes.GetBytes(); // Decrypt to access data
secureBytes.Dispose(); // Clean up memory
SecureString
Handle strings securely in memory:
var secureString = new SecureString("SensitiveData");
secureString.AppendData(" MoreData");
// Retrieve as plain text (temporarily)
string plainText = secureString.ToString();
secureString.Dispose(); // Clean up memory
Platform-Secure Storage
Store and retrieve secrets using platform-specific secure storage:
byte[] sensitiveData = Encoding.UTF8.GetBytes("Sensitive Data");
// Store data securely
Guid secretId = PlatformSecureStorage.StoreSecret(sensitiveData);
// Retrieve data securely
byte[] retrievedData = PlatformSecureStorage.RetrieveSecret(secretId);
// Remove secret
PlatformSecureStorage.RemoveSecret(secretId);
🔧 Technical Notes
- Windows (DPAPI):
- Data is encrypted with
ProtectedData
usingDataProtectionScope.CurrentUser
.
- Data is encrypted with
- Android:
- Uses AndroidX
EncryptedSharedPreferences
with AES-256-GCM and HMAC.
- Uses AndroidX
- iOS:
- Integrates with the Keychain to securely store and retrieve data.
- Fallback Mechanism:
- AES-256 with HMAC for encryption and integrity verification.
- ChaCha20 Encryption:
- Used for in-memory encryption with optional Associated Data (AAD).
🤝 Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-browser1.0 is compatible. net8.0-ios was computed. net8.0-ios18.0 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst18.0 is compatible. net8.0-macos was computed. net8.0-macos15.0 is compatible. net8.0-tvos was computed. net8.0-tvos18.0 is compatible. net8.0-windows was computed. net8.0-windows7.0 is compatible. 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. |
-
net8.0
- SimpleEncryption (>= 1.0.3)
-
net8.0-android34.0
- SimpleEncryption (>= 1.0.3)
- Xamarin.AndroidX.Security.SecurityCrypto (>= 1.0.0.24)
-
net8.0-browser1.0
- SimpleEncryption (>= 1.0.3)
-
net8.0-ios18.0
- SimpleEncryption (>= 1.0.3)
-
net8.0-maccatalyst18.0
- SimpleEncryption (>= 1.0.3)
-
net8.0-macos15.0
- SimpleEncryption (>= 1.0.3)
-
net8.0-tvos18.0
- SimpleEncryption (>= 1.0.3)
-
net8.0-windows7.0
- SimpleEncryption (>= 1.0.3)
- System.Security.Cryptography.ProtectedData (>= 9.0.1)
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 |
---|---|---|
1.0.0 | 43 | 1/24/2025 |
- Secure Data Types: Added SecureBytes, SecureString, SecureChar, and other secure data types for safe handling of sensitive information.
- Platform-Specific Security:
+ Windows: DPAPI integration for secure local storage.
+ Android: Uses EncryptedSharedPreferences with AES-256-GCM.
+ iOS: Supports Keychain Services.
+ Fallback Mechanism: Provides AES-based encryption for unsupported platforms.
- Key Management: Automatic key generation and storage using platform-secure methods.
- Flexible APIs:
+ Append, split, and transform secure strings.
+ Serialize and deserialize secure objects.
- Cross-Platform Support: Windows, Android, iOS, macOS, Linux, and more.