|
|
DynCrypto .NET Component information
How to use DynCrypto in a .NET application
.NET DynCrypto Methods Symmetric Key Cryptographic functions
Asymmetric Key Cryptographic functions
Hash functions (One Way functions)
DynCrypto Properties
SymEncrypt(Password as String, Data as String) as String
Encrypt a string using a Symmetric Key algorithm. Syntax:CipherText = DynCrypto.SymEncrypt(password,data)
ASP Example:Set DynCrypto = server.CreateObject("DynCrypto.Crypto") VB.NET Example:Dim DynCrypto As New netdyncrypto.dyncryptoDim CipherData As String CipherData = DynCrypto.SymEncrypt("MyPassword", "A Test String") 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 as String, ClearFileName
as String, CipherDir as String, ByRef OutputFileName as String , SetFileHash) as
Int32
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Parameters | Description |
| [in] Password | Encryption Password |
| [in] ClearFileName | Full file name pointing the file to encrypt. |
| [in] CipherDir | Must specify a directory or a file name (with its full path.) If a directory 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 path file name pointing the encrypted file. |
| [in] SetFileHash |
Should be set to True or False. When True, 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. |
Refer to sample: Symmetric Key File Encryption/Decryption
This method uses the algorithm CAST-128.
Decrypt a string encrypted with method "SymEncrypt." Use a Symmetric Key algorithm.
CipherText = DynCrypto.SymDecrypt(password,data)
| Parameters | Description |
| [in] Password | Encryption Password |
| [in] Data | Encrypted string to decrypt. |
| Return Value | Decrypted Data. Stored in String. |
Dim DynCrypto As New netdyncrypto.dyncrypto
Dim CipherData As String
Dim ClearData As String
'--- Encrypt a String
CipherData = DynCrypto.SymEncrypt("MyPassword", "MyTestString")
'--- Decrypt a crypted string
ClearData = DynCrypto.SymDecrypt("MyPassword", CipherData)
Decrypt an encrypted file with method "SymEncryptFile." Uses a Symmetric Key algorithm.
Result = DynCrypto.SymDecryptFile(Password,CipherFile,ClearDir,OutputFileName,HashCheckResult)
| 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] OutputFileName | Full path file name pointing the decrypted file. |
| [out] HashCheckResult | 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 HashCheckResult 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. |
Refer to sample: Symmetric Key File Encryption/Decryption
Encrypt a string using an Asymmetric Key algorithm.
CipherText = DynCrypto.AsymEncrypt(PublicKey,data)
| Parameters | Description |
| [in] PublicKey | Public encryption Key. String value generated with function "AsymPublicKey." |
| [in] Data | String to encrypt |
| Return Value | Encrypted Data. The string Base64 encoded. |
Refer to sample: Asymmetric Key String Encryption/Decryption
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.
Encrypt a File using an Asymmetric Key algorithm.
Result = DynCrypto.AsymEncryptFile(PublicKey,ClearFile,CipherFileName,OutputFileName,HashCheckResult)
| Parameters | Description |
| [in] PublicKey | Public encryption Key. String value generated with function "AsymPublicKey." |
| [in] ClearFileName | Full file name pointing the file to encrypt. |
| [in] CipherFileName | Define a directory or a file name (with its full path.) If a directory only is specified, a default name will be affected to the encrypted file. If a file name is specified, it will be used to create the encrypted file. |
| [out] OutputFileName | Full path file name pointing the encrypted file. |
| [in] SetFileHash | 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. |
Refer to sample: Asymmetric Key File Encryption/Decryption
This method uses two algorithms: Elliptic Curve and CAST-128.
Decrypt a string encrypted with method "AsymEncrypt." Use Asymmetric Algorithm.
CipherText = DynCrypto.AsymDecrypt(PrivateKey,data)
| Parameters | Description |
| [in] PrivateKey | Private key to decrypt the encrypted data. String Value. |
| [in] Data | Encrypted string to decrypt. String Value. |
| Return Value | Decrypted Data. Stored in String. |
Refer to sample: Asymmetric Key String Encryption/Decryption
Decrypt an encrypted file with method "AsymEncryptFile." Use an Asymmetric Key algorithm.
Result = DynCrypto.AsymDecryptFile(PrivateKey,CipherFile,ClearFile,OutputFile,HashCheckResult)
| Parameters | Description |
| [in] PrivateKey | Private Decryption Key |
| [in] CipherFileName | Full file name pointing the file to decrypt. |
| [in] ClearFileName | 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] OutputFileName | Full file name given to the decrypted file. |
| [out] HashCheckResult | 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. |
Refer to sample: Asymmetric Key File Encryption/Decryption
Generate a public key from a private key.
PublicKey = DynCrypto.AsymPublicKey(PrivateKey)
| Parameters | Description |
| [in] PrivateKey | Private Key. String value. |
| Return Value | Public Key. Base64 String Value. |
Dim DynCrypto As New netdyncrypto.dyncrypto
Dim PublicKey As String
PublicKey = DynCrypto.AsymPublicKey("MyPrivateKey")
Hash(Data as String) as String
![]()
Generate a Hash value from a data string.
HashString = DynCrypto.Hash(Data)
| Parameters | Description |
| [in] Data | Data. String value. |
| Return Value | Hash Value Base64 coded, stored in a string |
Dim DynCrypto As New netdyncrypto.dyncrypto
Dim HashString As String
HashString = DynCrypto.Hash("Please Hash this string")
HashToArray(Data as String)
as System.Array ![]()
Generate a Hash value from a data string.
HashArray = DynCrypto.HashToArray(Data)
| Parameters | Description |
| [in] Data | Data. String value. |
| Return Value | Hash value stored in a System.Array |
Dim DynCrypto As New netdyncrypto.dyncrypto
Dim HashArray As Array
HashArray = DynCrypto.HashToArray("Please Hash this string")
Generate a Hash value from a file.
HashValue = DynCrypto.HashFile(FileName)
| Parameters | Description |
| [in] FileName | Full path file name. String value. |
| Return Value | Hash Value Base 64 coded, stored in a string. |
Dim DynCrypto As New netdyncrypto.dyncrypto
Dim HashString As String
HashString = DynCrypto.HashFile("c:\temp\news.txt")
Generate a Hash value from a file.
HashValue = DynCrypto.HashFile(FileName)
| Parameters | Description |
| [in] FileName | Full path file name. String value. |
| Return Value | Hash value stored in a System.Array. |
Dim DynCrypto As New netdyncrypto.dyncrypto
Dim HashArray As Array
HashArray = DynCrypto.HashFileToArray("c:\temp\news.txt")
Define if DynCrypto will throw exceptions on decryptio failures. This usually occurs when the password is invalid.
DynCrypto.BreakOnDecryptError = true or false
Settings:
If "true," the component will throw exceptions on decryption failures.
If "false," the component will NOT throw exception on decryption failure.
Default value is "true."
Return information on the license currently registered.
CurrentLicenseInfo = DynCrypto.LicenseInfo
Load the license information.
License = DynCrypto.LoadLicense(Owner,Key)
| Parameters | Description |
| [in] Owner | Owner. Part of the license information. |
| [in] Key | Key. Part of the license information. |
| Return Value | Non zero if license information is valid. |
If parameter "Owner" and "Key" are empty, the component will search the license information in file DYNCRYPTO.INI located in the same directory as NETDYNCRYPTO.DLL. If parameter "Owner" and "Key" are specified with invalid values, file DYNCRYPTO.INI is not searched and not needed.
Return information on the current version of DynCrypto component.
VersionInfo = DynCrypto.Version(0)
| Parameters | Description | ||||||||
| [in] Option (Optional) |
|
||||||||
|