## Background:

The importance of data encryption and decryption is increasing due to the amount of sensitive data flowing across public communication systems. Data can traverse layers of encryption and decryption. Cryptographic algorithms are used to manage public-private key pairs to accomplish data security.

Public-key cryptographyThis challenge will demonstrate a very simple use of a key pair to encrypt and decrypt messages. However, the industry accepted mechanisms are significantly more complex.

## Your challenge:

Completing the challenge requires decryption of an encrypted secret message. A REXX routine that was used to encrypt the 'SECRET' message is available to you. You create a REXX encryption routine from a copy of the REXX decryption routine, then modify the encryption REXX routine. The objective is to use your REXX decryption routine to decrypt the 'SECRET' and write the decrypted message to P3.OUTPUT(#14).

__Challenge Details:__- CC#####.REXX.CLIST(ENCRYPT) is the REXX routine used to encrypt the message
- Copy CC#####.REXX.CLIST(ENCRYPT) into CC#####.REXX.CLIST(DECRYPT)
- The public and private encryption key is NOT hard coded in the REXX routine
- REXX routine reads the public and private key from partitioned data set member
- REXX routine assumes first line of an encrypted message is a public key
- The REXX 'say' statement can be used to display variables to help understand REXX routine syntax and logic
- Internet has lots of REXX tutorials and information
- REXX EXECIO statement is the API to read and write data
- EXECIO STEM operand establishes an array of data records
- Example 'STEM msg.' where 'msg.' is the STEM array, msg.1 is the first entry in the array, msg.2 is the second, and msg.i is used to increment array position by incrementing i.

__ENCRYPT REXX Routine Helpful Facts__- ZOS.PUBLIC.SECRET.MESSAGES(TESTMSG) is the ENCRYPT REXX routine test input
- ENCRYPT REXX routine created encrypted text located in ZOS.PUBLIC.SECRET.MESSAGES(TESTMSGX).
- ENCRYPT REXX routine was used to produce encrypted message in ZOS.PUBLIC.SECRET.MESSAGES(SECRET).
- Enter ex to the left of member ENCRYPT in CC#####.REXX.CLIST to execute and observe encryption.
- Remember that REXX say statement can be helpful by displaying variable values during execution.
- DECRYPT REXX routine can use TESTMSGX as input with the objective to decrypt TESTMSGX writing text found in TESTMSG to the screen.

__When DECRYPT routine is successfully decrypting TESTMSGX:__- Modify DECRYPT routine to decrypt ZOS.PUBLIC.SECRET.MESSAGES(SECRET)
- Modify DECRYPT routine to write the decrypted 'SECRET' message to P3.OUTPUT(#14)
- Observe comments in REXX routine to comment 'ALLOC FI(msgout) DA(*)' and uncomment 'ALLOC FI(msgout) DA(P3.OUTPUT(#14)'