Encrypt Decrypt Vb6 Source Code

  1. Vb6 Source Code Samples
  2. Vb6 Source Code Example
  3. Encrypt Decrypt Vb6 Source Codes
-->

The following VB.NET project contains the source code and VB.NET examples used for Encrypt decrypt file and save with any extension. You can read write file. C Program to Encrypt and Decrypt Files - In this article, you will learn and get code about how to encrypt or decrypt a file using C language. Data encryption means converting the original data.

You can use the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) to encrypt or decrypt sections of a Web configuration file. ASP.NET will automatically decrypt encrypted configuration elements when the Web.config file is processed.

Note

The Aspnet_regiis.exe tool is located in the %windows%Microsoft.NETFrameworkversionNumber folder.

You can also use the protected configuration classes in the System.Configuration namespace to encrypt and decrypt sections of a Web configuration file, sections of a configuration file for an executable (.exe), or sections in the machine-level and application-level configuration files. For more information, see the ProtectSection method of the SectionInformation class. For information on referencing a section of a Web.config file, see the WebConfigurationManager class. For information on referencing configuration sections of files other than the Web.config file, see the ConfigurationManager class.

Encrypting a Web Configuration Section

Vb6 source code free download

To encrypt configuration file contents, use the Aspnet_regiis.exe tool with the –pe option and the name of the configuration element to be encrypted.

Planet

Use the –app option to identify the application for which the Web.config file will be encrypted and the -site option to identify which Web site the application is a part of. The Web site is identified using the site number from the Internet Information Services (IIS) metabase. You can retrieve the site number from the INSTANCE_META_PATH server variable in the ServerVariables collection. For example, when IIS is installed, a Web site named 'Default Web Site' is created as site 1. Download template cv coreldraw x7. In pages served from that site, the INSTANCE_META_PATH server variable returns '/LM/W3SVC/1'. If you do not specify a -site option, site 1 is used.

Encrypt decrypt vb6 source code downloads

Use the –prov option to identify the name of the ProtectedConfigurationProvider that will perform the encryption and decryption. If you do not specify a provider using the -prov option, the provider configured as the defaultProvider is used.

Note

If you are using an RsaProtectedConfigurationProvider instance that specifies a custom key container, you must create the key container before running the Aspnet_regiis.exe tool. For more information, see Importing and Exporting Protected Configuration RSA Key Containers.

The following command encrypts the connectionStrings element in the Web.config file for the application SampleApplication. Because no -site option is included, the application is assumed to be from Web site 1 (most commonly Default Web Site in IIS). The encryption is performed using the RsaProtectedConfigurationProvider specified in the machine configuration.

When a page or other ASP.NET resource in the application is requested, ASP.NET calls the provider for the protected configuration section to decrypt the information for use by ASP.NET and your application code.

Note

Vb6 Source Code Samples

To decrypt and encrypt a section of the Web.config file, the ASP.NET process must have permission to read the appropriate encryption key information. For more information, see Importing and Exporting Protected Configuration RSA Key Containers.

Decrypting a Web Configuration Section

To decrypt encrypted configuration file contents, you use the Aspnet_regiis.exe tool with the -pd switch and the name of the configuration element to be decrypted. Download security task manager full crack. Use the –app and -site switches to identify the application for which the Web.config file will be decrypted. You do not need to specify the –prov switch to identify the name of the ProtectedConfigurationProvider, because that information is read from the configProtectionProvider attribute of the protected configuration section.

Code

The following command decrypts the connectionStrings element in the Web.config file for the ASP.NET application SampleApplication:

See Also

Vb6 Source Code Example

Tasks

Concepts

Other Resources

Encrypt Decrypt Vb6 Source Codes

Procedure NameTypeDescription
(Declarations)DeclarationsDeclarations and private variables for the CEncryption class.
InputFileNamePropertyGet the name of the input file.
OutputFileNamePropertyGet the name of the output file.
PasswordPropertyGet the password.
Class_InitializeInitializeSet initial values to defaults which may be overridden with property settings.
EncryptFileMethodEncrypt the file specified in m_strInputFileName to the file specified in m_strOutputFileName. This procedure uses buffered file reads and writes for better performance. The encrypted file produced by the method is reversible. This means that if you encrypt a file, reverse the InputFileName and OutputFileName properties, and call this method again, the original file is restored.
Note: The same password must be supplied to successfully decrypt the file. This method also raises an event called file progress. This event can be used to track the progress of the file being processed. See the example tab for an example of how to use this event. This method also uses a file buffer. Using a file buffer significantly speeds up the performance of this method.
EncryptStringMethodEncrypt/Decrypt the passed string with XOR encryption. The encrypted string produced by the method is reversible. This means that if you encrypt a string, then encrypt the results of that operation, the original string is restored.
Note: The same password must be supplied to successfully decrypt the string. See the example tab for a demonstration of this. If you need an ASCII version of this function, use the EncryptStringAscii method.
EncryptStringAsciiMethodEncrypt/Decrypt the passed string with XOR encryption, returning the result in ASCII format. The encrypted string produced by the method is reversible. This means that if you encrypt a string, then encrypt the results of that operation, the original string is restored.
Note: The same password must be supplied to successfully decrypt the string. See the example tab for a demonstration of this. The EncryptStringAscii method returns the result in ASCII format. If you need to pass the results of the EncryptString function on the command line, or use it external to your program, it is recommended that you use the ASCII version of this function.
EncryptBytePrivateEncrypt one byte, and modify the password. Modifying the password as we encrypt makes the encryption slightly harder to break.
ReadFilePrivateRead the specified number of bytes from the file. This function significantly increases the speed of processing files. The alternative to using a file buffer is reading a byte at a time from the file.