This chapter provides an overview of the crypt class and discusses:
Create a crypt object
Error handling
Data type of a crypt object
Scope of a crypt object
Crypt class reference
Understanding the Crypt ClassThe crypt class is used with pluggable cryptography. After you create an encryption profile, use PeopleCode to invoke the encryption profile for encrypting, decrypting, or signing a field, depending on the profile
See Also
Securing Data with Pluggable Cryptography
Creating a Crypt ObjectThe crypt class does not have a separate function for instantiating an object (such as CreateCrypt.) Instead, you instantiate a crypt object using the CreateObject function, using the keyword Crypt.
&cry = CreateObject("Crypt");
See CreateObject.
Declaring Crypt Objects
Crypt objects are declared by using the Crypt type name.
Local Crypt &MyCrypt;
Note. Crypt objects cannot be serialized, and so can only be declared as Local.
Scope of a Crypt Object
A crypt object can only be instantiated from PeopleCode. This object can be used anywhere you have PeopleCode, that is, in an application class, Component Interface PeopleCode, record field PeopleCode, and so on.
Crypt Class MethodsIn this section, we discuss the crypt class methods. The methods are discussed in alphabetical order.

FirstStepSyntax
FirstStep()
Description
Use the FirstStep method to access the first step in the encryption chain.
You must use either the FirstStep or GoToStep methods before you use the NextStep or SetParameter methods.
Parameters
None.
Returns
None.
See Also
GoToStep, NextStep, SetParameter.

GoToStepSyntax
GoToStep(StepNum)
Description
Use the GoToStep method to access a specific step in the encryption chain.
You must use either the GoToStep or FirstStep methods before you use the NextStep or SetParameter method.
Parameters
| 
 StepNum  | 
 Specify the step number that you want to access, as a number.  | 
Returns
None.
See Also
FirstStep, NextStep, SetParameter.

LoadLibrarySyntax
LoadLibrary(LibraryFile, LibraryID)
Description
Use the LoadLibrary method to specify the encryption library to be used. This method is generally used when either your underlying library changes (such as, a new version, added algorithms, and so on) or you have your written own library and you need to load the metadata into the PeopleSoft system.
Parameters
| 
 LibraryFile  | 
 Specify the name of the file containing the encryption library as a string. You do not have to specify a full path name. The delivered OpenSSL library is pspetssl.dll. The delivered PGP library is pspetpgp.dll.  | 
| 
 LibraryID  | 
 Specify the name of the library, as a string.  | 
Returns
None.

NextStepSyntax
NextStep()
Description
Use the NextStep method to access the next step in the encryption chain.
You must use the FirstStep or GoToStep method before using NextStep.
Your program terminates if you call NextStep when you are already at the last step in the encryption chain.
Parameters
None.
Returns
None.
See Also

OpenSyntax
Open(ProfileName)
Description
Use the Open method to open the encryption profile identified by ProfileName. You must open an encryption profile before you can add data to the encryption profile. Your program terminates if you specify an encryption profile that doesn't exist.
Parameters
| 
 ProfileName  | 
 Specify the name of the encryption profile you want to access, as a string. You can store the name of the encryption profile in a field, and specify a fieldname.recordname.  | 
Returns
None.
Example
Local Crypt &cry; &cry = CreateObject("Crypt"); &bar = QE_CRYPT_WRK.CRYPT_PRFL_ID; &cry.Open(&bar); &cry.UpdateData(QE_CRYPT_WRK.DESCRLONG); QE_CRYPT_WRK.LARGECHAR = &cry.Result;

SetParameterSyntax
SetParameter(Name, Value)
Description
Use the SetParameter method to set the parameter specified by Name to a value specified by Value.
You must have already used the FirstStep, NextStep, or GoToStep methods to specify a step before using this method.
Parameters
| 
 Name  | 
 Specify the name of the parameter that you want to change, as a string.  | 
| 
 Value  | 
 Specify the value for the parameter that you want to change.  | 
Returns
None.
See Also
FirstStep, GoToStep, NextStep.

UpdateDataSyntax
UpdateData(Data)
Description
Use the UpdateData method to add data to the encryption chain. This method can be called multiple times after opening a profile to add data.
Parameters
| 
 Data  | 
 Specify the data you want to add to the encryption chain, as a string.  | 
Returns
None.
Crypt Class PropertiesThis section describes the crypt class properties. The properties are described in alphabetical order.

ResultDescription
After updating the encryption chain, the Result property contains the end result of the encryption chain. Once the result has been retrieved, it is no longer possible to update the object anymore.
This property is read-only.

VerifiedDescription
For algorithms that check a signature, the system sets the Verified property to true if the signature is valid, and false if the signature is invalid. For algorithms that do not check a signature, it always returns false.
This property is read-only.