This is a work in progress as of March, 2016.
The complete draft of the readme follows these summary lists of completed and incomplete parts. Check back here for updates and thanks for your interest!
- Tests, documentation, and implementation of PagingInfo and related classes
- Tests, documentation, and implementation of Collections.Generic classes
- Implementation of ConvertByteArray and ConvertEncodedString static extension methods (pending tests)
- Documentation and implementation of FormatString static extension methods (pending tests)
- Tests and documentation of ConvertByteArray and ConvertEncodedString
- Final decisions about the contracts for Encryptor and Decryptor and their factory methods
- Tests, documentation, and implementation of the rest of the Cryptography namespace
- Tests of FormatString
- Tests, documentation, and implementation of NameValueCollectionExtensions
- Tests, documentation, and implementation of Enum utilities
- Refactor parts of Cryptography to use bitwise functions from Enum utilities
- Create builds for .NET 2.0, 4.0, 5.0, and Mono
- Deploy as public NuGet package
is a small assortment of adapters and extensions from mscorlib.dll
These are some useful types that I've rewritten enough times to not want to write them over again, so I have composed them into this open source project. ‑‑KRopa.
It is intended for eventual free distribution as a public NuGet package, but remains a pre‑release work in progress for now.
This library consists of:
- Security.Cryptography: Simplified generic encryption, decryption, and hashing of strings or byte arrays, as flexible as you need, but guiding you to the most secure implementation
- Collections.PagingInfo: Contracts and structs for managing "paged" lists
- Collections.Generic: Transformations back and forth between comma‑delimited strings and arrays of primitives
- Collections.Specialized: Extraction of primitive values from NameValueCollection, useful for old‑school HttpRequest.QueryString parsing
- ConvertByteArray and ConvertEncodedString: Conversions between byte arrays and compact encoded strings
- FormatString: String formatting for various output or sanitization
- ConvertEnum: (TBD) Tools for working with and converting Enum types, including simplified bitwise operations
Iterations of this library have a longer history than its public GitHub edition, and along the way parts of it have been made obsolete by successive releases of the .NET Framework.
Obsolescence has occurred when a new version of the framework includes a new type or method having uncanny resemblance (even down to the names!) to ones I had written from scratch prior to their appearance in the framework. Historical examples include TimeZoneInfo, IReadOnlyList, and the IsNullOrWhiteSpace method.
If my past ability to guess what Microsoft will add to mscorlib.dll is any guide, perhaps we'll be seeing Encryptor and Decryptor classes added by the time ASP.NET&nbps;5 is released!
The types in this library are for core infrastructure and aim to be as stable and reliable as the .NET Framework itself, including optimized performance, full test coverage, coding by contract, and detailed inline documentation. You should be able to consider a reference to misc.corlib as what Mark Seemann would call a "stable" (non‑volatile) depency.
As such, there is no particular emphasis on abstraction or points of dependency injection. The concrete Encryptor and Decryptor classes in the Security.Cryptography namespace, for example, do not specify an abstract contract because they are basically thin facades coordinating the cooperation of a few concrete .NET Framework types. The facades for cryptographic operations in this library are designed to guide an optimum implementation with a bit less ceremony, so it's more practical to simply treat them as concrete types themselves. Besides, they are already amply variable by their internal use of the abstract factory within the SymmetricAlgorithm class in mscorlib.dll
A pro tip, by the way: If you'd like to use dependency injection to specify which algorithms to use for encryption or hashing, the AlgorithmFactory class provides the injection point.
Since the types in this library target specific parts of the .NET Framework, their namespaces mimic the same structure.
I'm happy to make this library available publicly under the Apache 2 License, and am open to suggestions for improvement. Please feel to fork away, use as much or as little as you like, and submit pull requests.
Is in the form of a compiled help file, and inline within the code itself. It will be included in Visual Studio intellisense if the XML documentation comment file misc.corlib.XML is included adjacent to the reference.