Friday, July 5, 2013

DB2 TDES Encryption on Mainframe

TDES Encryption Algorithm can be used in DB2 tables as well. Suppose confidential numbers needs to be stored .We can ENCRYPT the value and store it.
Lets create the DB2 table like below


CREATE TABLE U202.CUST_DATA                                      
     (U_STR                CHAR(3) FOR SBCS DATA NOT NULL,         
      U_REG                CHAR(6) FOR SBCS DATA NOT NULL,         
      U_SKU                INTEGER NOT NULL,                       
      U_GIFT               CHAR(3) FOR SBCS DATA NOT NULL,         
      U_CREDIT_CARD        VARCHAR(40) FOR BIT DATA NOT NULL)

Now lets insert values into the table:

SET ENCRYPTION PASSWORD ='PWD1APRIL@' 
INSERT INTO U202.CUST_DATA                         
 VALUES('001', '123456', 1234, 'LCD', ENCRYPT_TDES ('9876543210123456'))

Now To Decrypt 

SET ENCRYPTION PASSWORD ='PWD1APRIL@';                       
SELECT DECRYPT_CHAR ("U_CREDIT_CARD") FROM U202.CUST_DATA 





1 comment:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in TECHNOLOGY , kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Saurabh Srivastava
    MaxMunus
    E-mail: saurabh@maxmunus.com
    Skype id: saurabhmaxmunus
    Ph:+91 8553576305 / 080 - 41103383
    http://www.maxmunus.com/


    ReplyDelete