EasyByte Software

Welcome to EasyByte Software

Home Buy Online Products Downloads Support
ASP and dotNET
Further Information



PGPFileEncrypt Method

Cryptocx v7 User Guide


PGPFileEncrypt Method

This is the method that you use to encrypt a file using PGP compatible encryption. This method is complementary to the PGPFileDecrypt method.



Encrypts a file using PGP compatible encryption.


x = object.PGPFileEncrypt

The syntax of the PGPFileEncrypt method has these parts:

Part Description
object A Cryptocx v7 control.
x A string that becomes either "TRUE" or "Error: xxx" where xxx is the error message.

Remarks If for whatever reason the method fails to complete, the method will return some text stating exactly what has gone wrong, if the method runs ok then the output from the method will = "TRUE".

This method requires the use of a public key ring, you have to specify the directory in which the public key ring resides though the KeyFolder property.

You need to specify the file to encrypt, the SourceFile.

You need to specify where the result of encrypting the source file will go, the DestinationFile.

You also need to specify what key to use, this is done through the KeyID property of the control.

You can optionally specify the property AsciiArmour this allows you to control the type of encrypted file to produce, binary or Ascii (more suitable for emailing for example). If not specified PGPFileEncrypt will default to 'yes'.



Example Sample Visual Basic Code to encrypt a file with PGP compatible encryption.

Where Cryptocx1 is an instance of a Cryptocx Control.

Dim theResult As String

Cryptocx1.SourceFile = "C:\filetoencrypt.txt"
Cryptocx1.DestinationFile = "C:\output.txt"
Cryptocx1.KeyFolder = "C:\mykeys"
Cryptocx1.KeyID = "mykey"
Cryptocx1.AsciiArmour = "yes"

theResult = Cryptocx1.PGPFileEncrypt

'' Check to see what has happened (if the decryption went ok without errors)

If theResult = "TRUE" Then
  '' Ok, the encryption went well with no errors
  MsgBox theResult
End If





Back to Contents Page


Click here to set this great site as your home page

Or click here to add it to your Favorites.


Copyright (c) EasyByte Software 1998-2008, info@easybyte.com