Click or drag to resize
weroSoft AG, Software
EncryptedDataProvider Klasse
The documentation is integral part of the weroSoft product documentation. This part is intended to be used by developers only.
Provides methods for accessing secured data from within the encrypted data store.
Vererbungshierarchie
SystemObject
  WeroSoft.SecurityEncryptedDataProvider

Namensraum:  WeroSoft.Security
Assembly:  WeroSoft.Core.Library (in WeroSoft.Core.Library.dll) Version: 2.1 Development Main
Syntax
C#
public sealed class EncryptedDataProvider : IEncryptedDataProvider, 
	IDisposable, IEncryptedDataCipherImplementation
Anmerkungen
The secured data provider allows accessing the data stored as nodes within the encrypted data store. Due to the goal keeping the information also encrypted in the memory, the provider does not allow to read out all data from the store by only one single operation.

Note that after creating an instance of this class, you must initialize the provider using a name and a password before accessing data from the store.

This encrypted data provider implementation supports multiple instances having their data in a store without be able to decrypt the data from another provider. The store returns only the data which is fitting to the appropriate provider asking for data.

Beispiele
The following example shows some code for creating and using a data provider.
// 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());
    }
}

Der EncryptedDataProvider Typ exponiert die folgenden Member.

Konstruktoren
  NameBeschreibung
Public MethodeEncryptedDataProvider
Initializes a new instance of the type EncryptedDataProvider.
Zurück nach oben
Eigenschaften
  NameBeschreibung
Public EigenschaftCipherImplementation
Gets the cipher implementation this provider is using.
Public EigenschaftCount
Gets the count of nodes for which this provider is responsible for.
Public EigenschaftEncryptedDataStore
Gets the secured data store behind the provider.
Public EigenschaftProviderId
Gets the identifier of the provider.
Public EigenschaftProviderName
Gets or sets the name of the provider.
Public EigenschaftTotalCount
Gets the total count of nodes independent of the provider.
Zurück nach oben
Methoden
  NameBeschreibung
Public MethodeClear
Clears the content of this particular provider.
Public MethodeCreateNode
Create a new node (a data object) in the store.
Public MethodeDecrypt
Decrypt a data object.
Public MethodeDispose
Implement the disposing behavior.
Public MethodeEncrypt
Encrypts a data object.
Public MethodeEquals
Determines whether the specified object is equal to the current object.
(Vererbt von Object.)
Public MethodeGetHashCode
Serves as the default hash function.
(Vererbt von Object.)
Public MethodeGetNodes
Gets a collection of nodes from the store.
Public MethodeGetProperty(Guid, Guid, Object)
Gets the decrypted content of one particular property.
Public MethodeGetPropertyT(Guid, Guid, T)
Gets the decrypted content of one particular property.
Public MethodeGetType
Gets the Type of the current instance.
(Vererbt von Object.)
Public MethodeInitialize
Initializes the data provider by a name and its corresponding password.
Public MethodeMove
Moves a node to a new parent.
Public MethodeMoveContent
Moves the nodes contained within the source node to the target node.
Public MethodeRemove
Removes a node from the store.
Public MethodeSetProperty
Sets the value of a particular property of a node.
Public MethodeToString
Returns a string that represents the current object.
(Vererbt von Object.)
Zurück nach oben
Erweiterungsmethoden
  NameBeschreibung
Public ErweiterungsmethodeClone(CloneWorkingMode, IEnumerableType)Überladen.
Clones an object by serialization.
(Definiert von RuntimeExtensions.)
Public ErweiterungsmethodeCloneT(CloneWorkingMode, IEnumerableType)Überladen.
Clones an object by serialization.
(Definiert von RuntimeExtensions.)
Public ErweiterungsmethodeConvert (Definiert von DataConverterExtensions.)
Public ErweiterungsmethodeDynamicCast
Dynamically casts a reference to another type.
(Definiert von TypeManagerHelper.)
Public ErweiterungsmethodeExtractSystemParametersFromTrigger
Extracts the system parameters from a collection of trigger parameter and transform them to a dictionary using string keys and string values.
(Definiert von TriggerExtensions.)
Public ErweiterungsmethodeGetFieldValue(String)Überladen.
Gets the data object held by a defined field of a particular type.
(Definiert von UnitTest.)
Public ErweiterungsmethodeGetFieldValueT(String)Überladen.
Gets the data object held by a defined field of a particular type.
(Definiert von UnitTest.)
Public ErweiterungsmethodeGetPropertyValue(String)Überladen.
Gets the data object held by a defined property of a particular type.
(Definiert von UnitTest.)
Public ErweiterungsmethodeGetPropertyValueT(String)Überladen.
Gets the data object held by a defined property of a particular type.
(Definiert von UnitTest.)
Public ErweiterungsmethodeInject(Type, Object)Überladen.
Injects all fields or properties which are marked with the defined attribute type name.
(Definiert von DataInjection.)
Public ErweiterungsmethodeInject(Type, Object, Boolean)Überladen.
Injects all fields or properties which are marked with the defined attribute type name.
(Definiert von DataInjection.)
Public ErweiterungsmethodeInjectField
Injects a value to a property within a data object.
(Definiert von DataInjection.)
Public ErweiterungsmethodeInjectProperty(String, Object)Überladen.
Injects a value to a property within a data object.
(Definiert von DataInjection.)
Public ErweiterungsmethodeInjectProperty(String, Type, Object)Überladen.
Injects a value to a property within a data object.
(Definiert von DataInjection.)
Public ErweiterungsmethodeInvoke(String, Object)Überladen.
Invokes a method on an object by reflection.
(Definiert von UnitTest.)
Public ErweiterungsmethodeInvokeTResult(String, Object)Überladen.
Invokes a method on an object by reflection.
(Definiert von UnitTest.)
Public ErweiterungsmethodeSetFieldValue
Sets the data object on a defined field of a particular type.
(Definiert von UnitTest.)
Public ErweiterungsmethodeSetPropertyValue
Sets the data object on a defined property of a particular type.
(Definiert von UnitTest.)
Public ErweiterungsmethodeSetReadOnlyFieldValue
Sets the data object on a defined field of a particular type.
(Definiert von UnitTest.)
Public ErweiterungsmethodeTryInjectProperty
Tries to Inject a value to a property within a data object.
(Definiert von DataInjection.)
Zurück nach oben
Siehe auch