Join the IBM Crypto Education community to explore and understand IBM cryptography technology. This community is operated and maintained by the IBM Crypto Development team.
/* Rexx */ /*-----------------------------------------------------------------*//* Description: *//* *//* Encrypt data with the secret key *//* *//*-----------------------------------------------------------------*/sae_rule_array_count = '00000003'x;sae_rule_array = 'AES ' || 'PKCS-PAD' || 'KEYIDENT';sae_key_identifier_length = '00000040'x;sae_key_identifier = left('SAMPLE.SECRET.AES256.KEY001',64);sae_init_vector_length = '00000010'x;sae_init_vector = '11111111111111111111111111111111'x;sae_block_size = '00000010'x;sae_clear_text_length = '0000000D'x;sae_clear_text = 'Hello World';sae_cipher_text_length = '00000020'x;sae_cipher_text = copies('00'x, 32); Call CSNBSAE; cipher_text = substr(sae_cipher_text,1,c2d(sae_cipher_text_length));say 'Cipher Text: ' c2x(cipher_text); Exit; /* --------------------------------------------------------------- *//* CSNBSAE - Symmetric Algorithm Encipher *//* *//* Encrypts data using a secure, symmetric key *//* *//* See the ICSF Application Programmer's Guide for more details. *//* --------------------------------------------------------------- */CSNBSAE: sae_rc = 'FFFFFFFF'x;sae_rs = 'FFFFFFFF'x;sae_exit_data_length = '00000000'x;sae_exit_data = '';sae_key_parms_length = '00000000'x;sae_key_parms = '';sae_chain_data_length = '00000020'x;sae_optional_data_length = '00000000'x;sae_optional_data = ''; ADDRESS linkpgm "CSNBSAE", 'SAE_RC' 'SAE_RS' , 'SAE_exit_data_length' 'SAE_exit_data' , 'SAE_rule_array_count' 'SAE_rule_array' , 'SAE_key_identifier_length' 'SAE_key_identifier' , 'SAE_key_parms_length' 'SAE_key_parms' , 'SAE_block_size' , 'SAE_init_vector_length' 'SAE_init_vector' , 'SAE_chain_data_length' 'SAE_chain_data' , 'SAE_clear_text_length' 'SAE_clear_text' , 'SAE_cipher_text_length' 'SAE_cipher_text' , 'SAE_optional_data_length' 'SAE_optional_data'; if (SAE_RC /= '00000000'x) Then say 'SAE Failed (rc=' c2x(SAE_RC)' rs='c2x(SAE_rs)')' ; return;
Copy