![]() | |
EncryptedDataProvider Class |
Namespace: WeroSoft.Security
public sealed class EncryptedDataProvider : IEncryptedDataProvider, IDisposable, IEncryptedDataCipherImplementation
// Create the store and a provider for accessing data in the store // Note that you may use one single combination for user name and password // or different combination for each of the element. using (EncryptedDataStore encryptedDataStore = new EncryptedDataStore()) { encryptedDataStore.Initialize("<userName>", "<password>"); using (IEncryptedDataProvider encryptedDataProvider = encryptedDataStore.GetDataProvider("providerUserName", "providerPassword")) { // Create a new data object (node) Guid node = encryptedDataProvider.CreateNode(Guid.Empty, "Demo object"); // Change a standard property string expectedName = "Demo object with updated name"; encryptedDataProvider.SetProperty(node, EncryptedDataKeyDefinitions.Name, expectedName); // Add a new custom property Guid property = Guid.NewGuid(); string content = "This content may be any serializable type. Note that this data is serialized binary"; encryptedDataProvider.SetProperty(node, property, content); // Get a property content of a standard property DateTime created = encryptedDataProvider.GetProperty<DateTime>( node, EncryptedDataKeyDefinitions.Created, DateTime.MinValue); // Change an existing custom property encryptedDataProvider.SetProperty(node, property, "New content!"); // Create a second element as subordinated node of the first node Guid subNode = encryptedDataProvider.CreateNode(node, "Demo object"); // Save the data store encryptedDataStore.Save("DemoDataStore.bin"); } } // Access the saved file using (EncryptedDataStore encryptedDataStore = new EncryptedDataStore()) { // Create a second instance of the store and read some values from it encryptedDataStore.Initialize("<userName>", "<password>"); // Load the data encryptedDataStore.Open("DemoDataStore.bin"); using (IEncryptedDataProvider encryptedDataProvider = encryptedDataStore.GetDataProvider("providerUserName", "providerPassword")) { // Get all root nodes of this particular provider Dictionary<Guid, string> nodeCollection = encryptedDataProvider.GetNodes(Guid.Empty); // Get the collection of nodes contained in the first node of the root collection Dictionary<Guid, string> subnodeCollection = encryptedDataProvider.GetNodes(nodeCollection.Keys.First()); } }
The EncryptedDataProvider type exposes the following members.
Name | Description | |
---|---|---|
![]() | EncryptedDataProvider |
Initializes a new instance of the type EncryptedDataProvider.
|
Name | Description | |
---|---|---|
![]() | CipherImplementation |
Gets the cipher implementation this provider is using.
|
![]() | Count |
Gets the count of nodes for which this provider is responsible for.
|
![]() | EncryptedDataStore |
Gets the secured data store behind the provider.
|
![]() | ProviderId |
Gets the identifier of the provider.
|
![]() | ProviderName |
Gets or sets the name of the provider.
|
![]() | TotalCount |
Gets the total count of nodes independent of the provider.
|
Name | Description | |
---|---|---|
![]() | Clear |
Clears the content of this particular provider.
|
![]() | CreateNode |
Create a new node (a data object) in the store.
|
![]() | Decrypt |
Decrypt a data object.
|
![]() | Dispose |
Implement the disposing behavior.
|
![]() | Encrypt |
Encrypts a data object.
|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetNodes |
Gets a collection of nodes from the store.
|
![]() | GetProperty(Guid, Guid, Object) |
Gets the decrypted content of one particular property.
|
![]() | GetPropertyT(Guid, Guid, T) |
Gets the decrypted content of one particular property.
|
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Initialize |
Initializes the data provider by a name and its corresponding password.
|
![]() | Move |
Moves a node to a new parent.
|
![]() | MoveContent |
Moves the nodes contained within the source node to the target node.
|
![]() | Remove |
Removes a node from the store.
|
![]() | SetProperty |
Sets the value of a particular property of a node.
|
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
![]() | Clone(CloneWorkingMode, IEnumerableType) | Overloaded.
Clones an object by serialization.
(Defined by RuntimeExtensions.) |
![]() | CloneT(CloneWorkingMode, IEnumerableType) | Overloaded.
Clones an object by serialization.
(Defined by RuntimeExtensions.) |
![]() | Convert | (Defined by DataConverterExtensions.) |
![]() | CreateTraceDataEntry(StringBuilder, SourceLevels, TraceableKind, String) | Overloaded.
Creates a data entry into a string builder according to the giving parameters.
(Defined by TraceExtensions.) |
![]() | CreateTraceDataEntry(SourceLevels, TraceableKind, String, String, Int32) | Overloaded.
Creates a trace entry for a data element.
(Defined by TraceExtensions.) |
![]() | CreateTraceDataEntry(StringBuilder, SourceLevels, TraceableKind, String, String, Int32) | Overloaded.
Creates a trace entry into a string builder.
(Defined by TraceExtensions.) |
![]() | DynamicCast |
Dynamically casts a reference to another type.
(Defined by TypeManagerHelper.) |
![]() | ExtractSystemParametersFromTrigger |
Extracts the system parameters from a collection of trigger parameter and transform them to a dictionary using string keys and string values.
(Defined by TriggerExtensions.) |
![]() | GetFieldValue(String) | Overloaded.
Gets the data object held by a defined field of a particular type.
(Defined by UnitTest.) |
![]() | GetFieldValueT(String) | Overloaded.
Gets the data object held by a defined field of a particular type.
(Defined by UnitTest.) |
![]() | GetPropertyValue(String) | Overloaded.
Gets the data object held by a defined property of a particular type.
(Defined by UnitTest.) |
![]() | GetPropertyValueT(String) | Overloaded.
Gets the data object held by a defined property of a particular type.
(Defined by UnitTest.) |
![]() | Inject(Type, Object) | Overloaded.
Injects all fields or properties which are marked with the defined attribute type name.
(Defined by DataInjection.) |
![]() | Inject(Type, Object, Boolean) | Overloaded.
Injects all fields or properties which are marked with the defined attribute type name.
(Defined by DataInjection.) |
![]() | InjectField |
Injects a value to a property within a data object.
(Defined by DataInjection.) |
![]() | InjectProperty(String, Object) | Overloaded.
Injects a value to a property within a data object.
(Defined by DataInjection.) |
![]() | InjectProperty(String, Type, Object) | Overloaded.
Injects a value to a property within a data object.
(Defined by DataInjection.) |
![]() | Invoke(String, Object) | Overloaded.
Invokes a method on an object by reflection.
(Defined by UnitTest.) |
![]() | InvokeTResult(String, Object) | Overloaded.
Invokes a method on an object by reflection.
(Defined by UnitTest.) |
![]() | SetFieldValue |
Sets the data object on a defined field of a particular type.
(Defined by UnitTest.) |
![]() | SetPropertyValue |
Sets the data object on a defined property of a particular type.
(Defined by UnitTest.) |
![]() | SetReadOnlyFieldValue |
Sets the data object on a defined field of a particular type.
(Defined by UnitTest.) |
![]() | TryInjectProperty |
Tries to Inject a value to a property within a data object.
(Defined by DataInjection.) |