XEncrypt Object

Overview

XEncrypt is an invisible client-side ActiveX control that exposes the same properties and methods as CryptoManager (with a few exceptions). This control enables you to perform all the cryptographic operations inside the IE browser directly on the client's machine. This is particularly useful for operations involving the user's private key such as digital signing and data decryption.

Unlike CryptoManager, XEncrypt does not require a registration key, so it can be freely downloaded to the client's machine. This control conveniently resides in the same DLL (aspencrypt.dll) as the rest of the AspEncrypt objects.

XEncrypt can only be used inside IE and not any other container. You must use CryptoManagager for VB and other development environments.

To use XEncrypt on the client side of your Web-based application, you must place the file aspencrypt.dll in a virtual directory where a client browser can find and download it. The easiest method is to place the file in the same virtual directory as an HTML or ASP file that references it. Your HTML or ASP file must reference XEncrypt as follows:

<OBJECT
classid="CLSID:F9463571-87CB-4A90-A1AC-2284B7F5AF4E"
codeBase="aspencrypt.dll"
id="XEncrypt">
</OBJECT>

XEncrypt exposes the same properties as CryptoManager except RegKey and Expires. It exposes the same methods as CryptoManager except LogonUser and RevertToSelf. One additional method is PickCertificate described below.

Member List

Properties

This object exposes the same properties and CryptoManager except RegKey and Expires.

Methods


Function PickCertificate(Store As CryptoStore, Flags As Long, Caption As String, Message As String) As CryptoCert

This method uses the undocumented CryptoAPI function CryptUIDlgSelectCertificateW which displays a list of certificates from a certificate store specified by Store.

Flags specifies what columns are to be displayed in the certificate dialog. If Flags is 0, all 6 columns are to be displayed:

  • Issued to
  • Issued by
  • Intended Usage
  • Friendly Name
  • Expiration Date
  • Location

To hide any of these columns, use a combination (sum) of the following flags:

&H01 hides "Issued to"
&H02 hides "Issed by"
&H04 hides "Indended Usage"
&H08 hides "Friendly Name"
&H10 hides "Location"
&H20 hides "Expiration Date"

For example, the value 28 (&H04 + &H08 + &H10 = &H1C) hides all columns except Issued to, Issued by and Expiration Date.

Caption, if set to a non-empty string, specifies the caption of the certificate dialog. If an empty string is specified, the default caption will be displayed.

Message, if set to a non-empty string, specifies the message inside the dialog above the certificate list. If an empty string is specified, the default message will be displayed.

Returns a CryptoCert object representing the user-selected certificate, or Nothing if the user clicks Cancel.

Usage:

Set Store = XEncrypt.OpenStore("MY", False)
Set Cert = XEncrypt.PickCertificate(Store, _
  28, "Select Certificate Please", _
  "Select the one you want to be used for signing")

Related Tasks: 8.4 Signing with Personal Certificates.

CryptoBlob