Opens a cryptographic context. Container specifies the key container name.
MachineKey specifies whether the container is located under the HKEY_LOCAL_MACHINE
(if True) or HKEY_CURRENT_USER (if False) section of the system registry.
Use True if AspEncrypt is used in an ASP environment, or False otherwise.
If the specified
container is empty a key-exchange and signature key pairs will be created automatically.
If CreateNew is specified and set to True the key container
will be populated by a new set of key pairs.
As of Version 2.5, Container may contain public-key length separated
from the container name with "##", e.g. "mycontainer##2048". By default, the key length is 1024.
This method uses the default cryptographic service provider.
To specify a provider name explicitly, use OpenContextEx instead.
When a container name is not specified, AspEncrypt does
not attempt to access private keys, which results in a significant
improvement in performance and eliminates certain concurrency problems.
You should not use the containerless mode
if you call the method Context.GetUserKey .
You must use this mode if you call the methods
Context.CreateExponentOneKey
and Context.ImportRawKey.
Return value: a CryptoContext object representing the newly
opened cryptographic context.
Usage:
Set Context = CM.OpenContext("mycontainer", True) (key length: 1024)
or
Set Context = CM.OpenContext("", True)
or
Set Context = CM.OpenContext("mycontainer##2048", True)
(key length: 2048, requires version 2.5+).
Relevant Section: 2.2 OpenContext and OpenContextEx Methods.