TripleDesCreator Property
TripleDesCreator
This property is a delegate (function pointer). The method loaded
will return an instance of TripleDES
.
public static Func<TripleDES> TripleDesCreator { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.Security.Cryptography.TripleDES> |
Remarks
When an SDK operation needs to encrypt or decrypt data using
Triple-DES, it will do so using an implementation of the
System.Security.Cryptography.TripleDES
abstract class.
However, when it needs the Triple-DES class, it will ask this
delegate to build an object, rather than ask for an object itself.
This has to do with the fact that the TripleDES
class
implements IDisposable
. In order to avoid the complex problem
of ownership of an object that will be disposed once it goes out of
scope, the SDK will create a new object each time one is needed. This
new object will be in scope only for the duration of its use in the
SDK, and will be disposed immediately when the SDK is done with it.
The method loaded will return an object. This class is initialized with a method that will build and return an instance of the C# default implementation. For example, it could be used as follows.
TripleDES tripleDesObject = CryptographyProviders.TripleDesCreator();
If you want to replace the implementation, you will likely do something like this in your application.
CryptographyProviders.TripleDesCreator = () =>
{
Handle tripleDesHandle = GetHandle();
return TDesImpl.GetTripleDesObject(tripleDesHandle);
};