public Byte2EncodingKeyValueStorage(KeyValueStorage <byte[]> baseStorage) { this.baseStorage = baseStorage; if (baseStorage == null) { throw new ArgumentNullException("baseStorage"); } }
public RSAEncryptingKeyValueStorage(KeyValueStorage <byte[]> baseStorage, RSAParameters rsap) { if (baseStorage == null) { throw new ArgumentNullException("baseStorage"); } this.baseStorage = baseStorage; this.rsap = rsap; Initialize(); }
public AESEncryptingKeyValueStorage(KeyValueStorage <byte[]> baseStorage, byte[] key) { if (baseStorage == null) { throw new ArgumentNullException("baseStorage"); } if (key == null) { throw new ArgumentNullException("key"); } this.baseStorage = baseStorage; this.key = key; Initialize(); }
public GenericUserRepositoryCollection(DatabasePath path, RSAParameters?rsa) { if (path == null) { throw new ArgumentNullException("path"); } this.path = path; stores = new SortedDictionary <string, KeyValueStorage <byte[]> > (); eSymmetricKeys = new BPlusKeyValueStorage(path, "SymmetricKeys"); eMeta = new BPlusKeyValueStorage(path, "Meta"); eRepositoryConfigurations = new BPlusKeyValueStorage(path, "RepositoryConfigurations"); if (rsa.HasValue) { SetRSAParameters(rsa.Value); } }
//readonly DatabasePath path; public UserRepository(DatabasePath path, UserRepositoryConfiguration config) { if (path == null) { throw new ArgumentNullException("path"); } if (config == null) { throw new ArgumentNullException("config"); } Console.WriteLine("Reading KeyValueStores"); userNames = config.Users.OpenStorage <string> (path); userParents = config.UserParents.OpenStorage <byte[]> (path); userCerts = config.UserCerts.OpenStorage <byte[]> (path); userKeys = config.UserKeys.OpenStorage <byte[]> (path); userSigningCerts = config.UserSigningCerts.OpenStorage <byte[]> (path); userSigningKeys = config.UserSigningKeys.OpenStorage <byte[]> (path); userRepositories = config.UserRepositores.OpenStorage <byte[][]> (path); repositories = config.Repositores.OpenStorage <byte[]> (path); meta = config.Meta.OpenStorage <byte[]> (path); //permissions = new LevelDBKeyValueStorage<byte[]> (path.CreatePath (config.PermissionsPath)); genericRepositories = new SortedDictionary <byte[], GenericUserRepositoryCollection> (ByteSequenceComparer.Shared); loggedInUsers = new SortedDictionary <byte[], RSAParameters> (ByteSequenceComparer.Shared); Console.WriteLine("Done"); var e = userNames.GetEnumerator(); while (e.MoveNext()) { var user = e.Current; Console.WriteLine("user: {0}:{1}", user.Key, user.Value); genericRepositories.Add(user.Key, new GenericUserRepositoryCollection(path.CreatePath(user.Key.ToHexadecimal()), DeserializeKey(new MemoryStream(userCerts.Get(user.Key), false))) ); } }
public ChunkRepository( KeyValueStorage <byte[]> data, KeyValueStorage <byte[][]> dataDependencies, KeyValueStorage <byte[][]> dataTopLevels, KeyValueStorage <byte[]> meta, KeyValueStorage <byte[][]> metaDependencies, KeyValueStorage <byte[][]> metaTopLevels, KeyValueStorage <byte[][]> signatures, KeyValueStorage <byte[][]> chunkSymmetricKeys, KeyValueStorage <byte[]> index, IDictionary <byte[], KeyValueStorage <byte[]> > encryptedData ) { this.lindex = index; this.ldata = data; this.ldataDependencies = dataDependencies; this.ldataTopLevels = dataTopLevels; this.lmeta = meta; this.lmetaDependencies = metaDependencies; this.lmetaTopLevels = metaTopLevels; this.lsignatures = signatures; this.lchunkSymmetricKeys = chunkSymmetricKeys; this.lencryptedData = new SortedDictionary <byte[], KeyValueStorage <byte[]> > (encryptedData); }