dyncrypto.gif (1598 bytes)

 
  Documentation     

DynCrypto object information

ProgID DynCrypto.Crypto
Automation Object Crypto Class
File name DYNCRYPTO.DLL
CLSID DCB529C1-18E6-11D3-BBF2-00609751CA88
IID DCB529BE-18E6-11D3-BBF2-00609751CA88

How to create a DynCrypto instance

Microsoft Windows Scripting Host (VBS)

Set DynCrypto = WScript.CreateObject("Dyncrypto.crypto")


Active Server Page (ASP)

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")

or 

Set DynCrypto = CreateObject("DynCrypto.Crypto")


Microsoft Visual Basic

Dim DynCrypto As Object
Set DynCrypto = CreateObject("DynCrypto.Crypto")


Microsoft Access

Dim DynCrypto As Object
Set DynCrypto = CreateObject("DynCrypto.Crypto")


Microsoft Internet Explorer

<object id="dyncrypto" classid="clsid:DCB529C1-18E6-11D3-BBF2-00609751CA88">
</object>


SQL Server Stored procedure

DECLARE @object int
DECLARE @hr int
EXEC @hr = sp_OACreate 'DynCrypto.Crypto', @object OUT

(DynCrypto 1.5.2 or newer required)


DynCrypto Methods

Symmetric Key Cryptographic functions

Asymmetric Key Cryptographic functions

Hash functions (One Way functions)

DynCrypto Properties


SymEncrypt(Password, Data)

Encrypt a string using a Symmetric Key algorithm.

Syntax:

CipherText = DynCrypto.SymEncrypt(password,data)

Parameters Description
[in] password Encryption Password
[in] data String to encrypt
Return Value Encrypted string

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
Password = "My Password"
Data = "Please encrypt this string"
CipherText = DynCrypto.SymEncrypt(password,Data)

Remark:

After encryption, the string is encoded with Base64. Therefore, it can safely be sent on the Internet. This method uses the algorithm CAST-128.


SymEncryptFile(Password, ClearFileName, CipherDir, CipherFileName [, HashCheck])

Encrypt a File using a Symmetric Key algorithm.

Syntax:

Result = DynCrypto.SymEncryptFile(Password,ClearFile,CipherDir,CipherFile)

Parameters Description
[in] Password Encryption Password
[in] ClearFileName Full file name pointing the file to encrypt.
[in] CipherDir Define a directory or a file name (with its full path.) If a directory only is specified, a default name will be chosen for the encrypted file. If a file name is specified, it will be used to create the encrypted file.
[out] CipherFileName Full file name pointing the encrypted file.
[in] HashCheck
(Optional)
Should be set to True or False. When enabled, a hash value of the clear file is stored in the header of the encrypted file. Therefore, while decrypting the encrypted file, the function will be able to check if the decryption process succeeded. In other words, that the password was correct and that the encrypted file was not corrupted. When enabled, the processing time for encryption and decryption is increased. Default value is True.
Return Value Zero on success, Nonzero on failure. The value returned is an Win32 error code.

Example: 

Refer to sample: Symmetric Key File Encryption/Decryption

Remark:

This method uses the algorithm CAST-128.


SymDecrypt(Password, Data [,Option])

Decrypt a string encrypted with method "SymEncrypt." Use a Symmetric Key algorithm.

Syntax:

CipherText = DynCrypto.SymDecrypt(password,data)

Parameters Description
[in]  Password Encryption Password
[in] Data Encrypted string to decrypt.
[in] Option
(Optional)
Specify the variant type for the data returned by the method.
Default value: "8" (BSTR, vbString)
Value Constant Description
   2 vbInteger Integer subtype
   3 vbLong Long subtype
   4 vbSingle Single subtype
   5 vbSingle Double subtype
   6 vbCurrency Currency subtype
   7 vbDate Date subtype
   8 vbString String subtype
  11 vbBoolean Boolean subtype
  14 vbDecimal Decimal subtype
  17 vbByte Byte subtype
8215 vbArray | vbByte Array of bytes
Return Value Decrypted Data. Stored in Variant. The variant type is defined by parameter "Option." BSTR by default.

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
Password = "My Password"
ClearText = DynCrypto.SymDecrypt(password,CipherText)


SymDecryptFile(Password, CipherFile, ClearDir, ClearFile [, HashCheck])

Decrypt an encrypted file with method "SymEncryptFile." Use a Symmetric Key algorithm.

Syntax:

Result  = DynCrypto.SymDecryptFile(Password,CipherFile,ClearDir,ClearFile)

Parameters Description
[in]  Password Decryption password 
[in] CipherFile Full file name pointing the file to decrypt.
[in] ClearDir Define a directory or a file name (with its full path.) If a directory only is specified, the original name of the clear file will be given to the uncrypted file. If a file name is specified, it will be used to create the decrypted file.
[out] ClearFile Full file name pointing to the decrypted file.
[out] HashCheck
(Optional)
This variable is set to True or False by function. True means that the decryption process succeeded. False means that it failed. Failure is usually due to an invalid password. If option HashCheck was not enabled while encrypting the file, False is always returned. However, the decryption process, still may or may not succeed.
Return Value Zero on success, Nonzero on failure. The value returned is a Win32 error code.

Example:

Refer to sample: Symmetric Key File Encryption/Decryption


AsymEncrypt(PublicKey, Data)

Encrypt a string using an Asymmetric Key algorithm.

Syntax:

CipherText = DynCrypto.AsymEncrypt(PublicKey,data)

Parameters Description
[in] PublicKey Public encryption Key. String value generated with method "AsymPublicKey."
[in] Data String to encrypt
Return Value Encrypted Data. Base64 string value.

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
PrivateKey = "My Password"
PublicKey = DynCrypto.AsymPublicKey(PrivateKey)
Data = "Please encrypt this string"
CipherText = DynCrypto.AsymEncrypt(PublicKey,Data)

Remark:

After encryption, the string is encoded with Base64. Therefore, it can safely be sent on the Internet. This method uses two algorithms: Elliptic Curve and CAST-128.


AsymEncryptFile(PublicKey, ClearFileName, CipherDir, CipherFileName [, HashCheck])

Encrypt a File using an Asymmetric Key algorithm.

Syntax:

Result = DynCrypto.AsymEncryptFile(PublicKey,ClearFile,CipherDir,CipherFile)

Parameters Description
[in] PublicKey Public encryption Key. String value generated with function "AsymPublicKey."
[in] ClearFileName Full file name pointing the file to encrypt.
[in] CipherDir Define a directory or a file name (with its full path.) If a directory only is specified, a default name will be chosen for the encrypted file. If a file name is specified, it will be used to create the encrypted file.
[out] CipherFileName Full file name given to the encrypted file.
[in] HashCheck
(Optional)
Should be set to True or False. When enabled, a hash value of the clear file is stored in the header of the encrypted file. Therefore, while decrypting the encrypted file, the function will be able to check if the decryption process succeeded. In other words, that the password was correct and that the encrypted file was not corrupted. When enabled, the processing time for encryption and decryption is increased. Default value is True.
Return Value Zero on success, Nonzero on failure. The value returned is a Win32 error code.

Example: 

Refer to sample: Asymmetric Key File Encryption/Decryption

Remark:

This method uses two algorithms: Elliptic Curve and CAST-128.


AsymDecrypt(PrivateKey, Data [,Option])

Decrypt a string encrypted with method "AsymEncrypt." Use Asymmetric Algorithm.

Syntax:

CipherText = DynCrypto.AsymDecrypt(PrivateKey,data)

Parameters Description
[in] PrivateKey Password to decrypt the encrypted string.
[in] Data Encrypted string to decrypt. String Value.
[in] Option
(Optional)
Specify the variant type for the data returned by the method.
Default value: "8" (BSTR, vbString).
Value Constant Description
   2 vbInteger Integer subtype
   3 vbLong Long subtype
   4 vbSingle Single subtype
   5 vbSingle Double subtype
   6 vbCurrency Currency subtype
   7 vbDate Date subtype
   8 vbString String subtype
  11 vbBoolean Boolean subtype
  14 vbDecimal Decimal subtype
  17 vbByte Byte subtype
8215 vbArray | vbByte Array of bytes
Return Value Decrypted Data. Stored in Variant. The variant type is defined by parameter "Option." BSTR by default.

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
PrivateKey = "My Password"
ClearText = DynCrypto.AsymDecrypt(PrivateKey,CipherText)

Remark:


AsymDecryptFile(PrivateKey, CipherFile, ClearDir, ClearFile [, HashCheck])

Decrypt an encrypted file with method "AsymEncryptFile." Use an Asymmetric Key algorithm.

Syntax:

Result  = DynCrypto.AsymDecryptFile(PrivateKey,CipherFile,ClearDir,ClearFile)

Parameters Description
[in]  PrivateKey Private Decryption Key
[in] CipherFile Full file name pointing the file to decrypt.
[in] ClearDir Define a directory or a file name (with its full path.) If a directory only is specified, the original name of the clear file will be given to the uncrypted file. If a file name is specified, it will be used to create the decrypted file.
[out] ClearFile Full file name given to the decrypted file.
[out] HashCheck
(Optional)
This variable is True or False by function. True means that the decryption process succeeded. False means that it failed. Failure is usually due to an invalid password. If option HashCheck was not enabled while encrypting the file, False is always returned. However, the decryption process, still may or may not succeed.
Return Value Zero on success, Nonzero on failure. The value returned is a Win32 error code.

Example:

Refer to sample: Asymmetric Key File Encryption/Decryption


AsymPublicKey(PrivateKey)

Generate a public key from a private key.

Syntax:

PublicKey = DynCrypto.AsymPublicKey(PrivateKey)

Parameters Description
[in] PrivateKey Private Key. String value.
Return Value Public Key. Base64 String Value.

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
PrivateKey = "My Password"
PublicKey = DynCrypto.AsymPublicKey(PrivateKey)


Hash(Data [, OutpuType])

Generate a Hash value from a data string.

Syntax:

HashValue = DynCrypto.Hash(Data)

Parameters Description
[in] Data Data. String value.
[in] OutputType
(optional)
0 (default): Hash Value will be stored in a string. The hash value is generated with SHA-1 and coded with Base64.
1: The Hash Value generated with SHA-1 is stored in an array of bytes. 
Return Value Hash Value. Stored in a string or array of bytes.

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
Data = "Please Hash this string"
HashValue = DynCrypto.Hash(Data)


HashFile(Data [, OutputType])

Generate a Hash value from a file.

Syntax:

HashValue = DynCrypto.HashFile(FileName)

Parameters Description
[in] Data Data. String value.
[in] OutputType
(optional)
0 (default): Hash Value will be stored in a string. The hash value is generated with SHA-1 and coded with Base64.
1: The Hash Value generated with SHA-1 is stored in an array of bytes. 
Return Value Hash Value. Stored in a string or array of bytes.

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
FileName = "c:\temp\news.txt"
HashValue = DynCrypto.HashFile(FileName)


BreakOnDecryptError

Specify if DynCrypto will raise a VBScript error when it could not decrypt correctly a string. This usually occurs when the password is invalid.

Syntax:                            

DynCrypto.BreakOnDecryptError = true or false

Settings:

If "true," the component will raise a VBScript error on decryption failure.
If "false," the component will NOT raise a VBScript error on decryption failure.
Default value is "true."


LicenseInfo

Return information on the license currently registered.

Syntax:

CurrentLicense = DynCrypto.LicenseInfo


LoadLicense(Owner, Key)

Load the license information.

Syntax:

License = DynCrypto.LoadLicense(Owner,Key)

Parameters Description
[in] Owner
(optional)
Owner. Part of the license information.
[in] Key
(optional)
Key.  Part of the license information.
Return Value Non zero if license information is valid.

ASP Example:

Set DynCrypto = server.CreateObject("DynCrypto.Crypto")
License = DynCrypto.LoadLicense("MyCompany","qxdkfljskjikjsrgsdfgsdfsfgsfdgqsfdgsdfgsdf=")

Remark:

If parameter "Owner" and "Key" are empty or not defined, the component will search the license information in file LICENSE.INI located in the same directory as DYNCRYPTO.DLL. If parameter "Owner" and "Key" are specified with invalid values, file LICENSE.INI is not searched.


Version(Option)

Return information on the current version of DynCrypto component.

Syntax:

VersionInfo = DynCrypto.Version(0)

Parameters Description
[in] Option
(Optional)
Acceptable values are:
0: Default Value. Return the version information in a string value.
1: Return the version information in long integer value. Useful for version comparison.
2: Return the version information of the internal cryptographic library.
 

                                                          DynCrypto is an OpenFuture Software, Inc. Product