CSharp library implementation of CommonSecrets format.
CommonSecrets is specification for storing encrypted and plaintext login information (username, password, URL etc.), notes, files, contacts and payment cards.
You can e.g. create your own password manager that is compatible with CommonSecrets specifications.
- Either use nuget package OR download src folder content, build it and add it to your project
- Create CommonSecretsContainer and add stuff to it
- Serialize it to your chosen data-interchange format (JSON, XML, YAML etc.)
- Deserialize the content and continue to add stuff to it
- Jump back to step 3.
Same in actual code, step 2.
using CSCommonSecrets;
// Create CommonSecretsContainer
CommonSecretsContainer csc = new CommonSecretsContainer();
string password = "dragon667";
byte[] initialCounter1 = new byte[] { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff };
SettingsAES_CTR settingsAES_CTR1 = new SettingsAES_CTR(initialCounter1);
SymmetricKeyAlgorithm skaAES = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 256, settingsAES_CTR1);
KeyDerivationFunctionEntry kdfe = KeyDerivationFunctionEntry.CreateHMACSHA256KeyDerivationFunctionEntry("master");
byte[] derivedPassword = kdfe.GeneratePasswordBytes(password);
// Add Key Derivation Function to CommonSecretsContainer
csc.keyDerivationFunctionEntries.Add(kdfe);
// Add Login Information secret
csc.loginInformationSecrets.Add(new LoginInformationSecret(new LoginInformation("My site", "https://example.com", "CoolGuy1990", "NobodyKnows1!"), kdfe.GetKeyIdentifier(), skaAES, derivedPassword));
step 3.
using CSCommonSecrets;
using System.Text.Json;
using System.Text.Json.Serialization;
string json = JsonSerializer.Serialize(csc, serializerOptions);
step 4.
using CSCommonSecrets;
using System.Text.Json;
using System.Text.Json.Serialization;
CommonSecretsContainer cscDeserialized = JsonSerializer.Deserialize<CommonSecretsContainer>(json);
Library and its source code are licensed under Unlicense, so you might use these as you wish.
0.2 Mention some additions
0.1 First public release