This is a reference to an ENVISecureString object, which contains a cryptographically encrypted string. Encryption and decryption are performed using the RSA asymmetric cryptosystem and requires use of a public and private key pair. As denoted by their names, the public key is shared with others, while the private key should be kept secret.

Example


This example creates an ENVISecureString object using the specified string and public key and then decrypts it using the private key.

; Start the application
e = ENVI(/HEADLESS)
 
; 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-----')
 
; Decrypt the ENVISecureString using the private key
PRINT, SecureString.ciphertext.Decrypt('-----BEGIN RSA PRIVATE KEY-----' + string(10b) + $
'MIIBOQIBAAJBAPOXacw2mXRlHhP8xBfwm+7GPKnPb6lqDfWdo/HWRj8qmezUMa280n7s1LUBWk' + string(10b) + $
'bJ7l13vcZCyfaDsL7FEqIHqwsCAwEAAQJAYLdcnWWMVkeTwrHYlfzFnO9+xJmFJ0nhkwTtRCck' + string(10b) + $
'qw0T0EV7lpOKv/tpR0TcuZfWxXs3AxYSMJNQyOh33nTqyQIhAP1Tn/lPDnSs21iVXSzDa/rNuH' + string(10b) + $
'2QYMCaaUHcgBedKTrdAiEA9il8/CZMDNFFEug4p/R7LVkWDGjLfBOmVDNQaiv82wcCIC7xAAPC' + string(10b) + $
'knssTLjtdIaG78tZs4YQ6tzFwBtkMJgvlyRBAiBusBcoVpwpw0v5BXy8YR2mNYHJkLG3GCrZf7' + string(10b) + $
'1wEFmBrwIgUHcyGsQAeSZ6biUO/IirsWMnGt2FVou23BH+EE0yLCU=' + string(10b) + $
'-----END RSA PRIVATE KEY-----')

IDL prints:

a secret string

Syntax


Result = ENVISecureString([, Keywords=value])

Return Value


This routine returns a reference to an ENVISecureString object.

Methods


Dehydrate

Hydrate

Arguments


None

Properties


Properties marked as (Get) can be retrieved, but not set.

CIPHERTEXT (Get)

The encrypted string. The IDL_String::Decrypt() method may be used on this property's value. Refer to the IDL Help for details on this method.

Keywords


ENVISecureString is constructed using the following two keywords:

ERROR

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.

PLAINTEXT (required)

Set this keyword 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.

PUBLIC_KEY (required)

Set this keyword to the RSA public key in PEM format. See IDL_String in IDL Help for more information.

Version History


ENVI 5.6.3

Introduced

API Version


4.2