Use the Hydrate static function method to create the object from its dehydrated form. The dehydrated form consists of a hash containing the object’s properties and values. The Hydrate and Dehydrate methods let you store the object state in memory and restore it later.

Representing an object as a hash is necessary for running ENVI analytics with the ENVI Task Engine.

See the ENVIHydrate function if you are creating a general IDL routine that will restore multiple object types.

For additional information, see What are Hydrate and Dehydrate routines used for?


; Start the application
; Create the ENVISecureString using the public key
SecureString = ENVISecureString(PLAINTEXT='a secret string', $
PUBLIC_KEY= '-----BEGIN PUBLIC KEY-----' + string(10b) + $
'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAPOXacw2mXRlHhP8xBfwm+7GPKnPb6lqDfWdo/HWR' + string(10b) + $
'j8qmezUMa280n7s1LUBWkbJ7l13vcZCyfaDsL7FEqIHqwsCAwEAAQ==' + string(10b) + $
'-----END PUBLIC KEY-----')
; Retrieve the dehydrated hash
dehydratedForm = secureString.Dehydrate()
; Restore the object
newSecureString = ENVISecureString.Hydrate(dehydratedForm)
Print, newSecureString, /IMPLIED_PRINT


Result = ENVISecureString.Hydrate(DehydratedForm, ERROR=value)

Return Value

The result is a reference to a new object instance of the spatial reference.






Required. A string value of SecureString indicating what object type the hash represents.

plainText Required. Set this to the plain text string to be encrypted. Note that the maximum length of this string depends on the public/private key pair key size. See IDL_String in IDL Help for more information.
publicKey Required. Set this to the RSA public key in PEM format. See IDL_String in IDL Help for more information.



Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

Version History

ENVI 5.6.3


API Version


See Also

ENVISecureString, ENVISecureString::Dehydrate