Showing posts with label Decrypt AES encrypted Password in WCS. Show all posts
Showing posts with label Decrypt AES encrypted Password in WCS. Show all posts

Thursday, April 9, 2020

Decrypt AES encrypted Password in WCS

                   How to Decrypt AES encrypted Password in WCS 

package com.xyz.commerce.me.datatype;

import com.ibm.commerce.ejb.helpers.nc_crypt;
import com.ibm.commerce.util.wrapper.AES128Cryptx;

public class test {
        public static void main(String[] args) throws Exception {

                System.out.println("merchantKey         ");
               
                String key = "PxrEn69MEqvE4rGLFnQoxZl6VAbbxVvQp2bPrDKxAYX=";
                System.out.println("str length         " + key.length());

//TO decrypt merchent key in CustomKeys.xml

                String keyFileValue = "HuRIPYJ92f5mf1iMUDqTLivbros95jcCNTWSjcgDh/dCbdAn9LR+JEEn7X3PsHkhUk+zl6XhSU2rH0RtwKBgwg=="; //value present in keyFile file.
                String KeyEncryptionFileValue= "1234567890abcdef1234567890abcdef"; //Value present in keyEncryptionFile file.


                String decryptedMerchantKey = AES128Cryptx.decrypt(keyFileValue,KeyEncryptionFileValue, false) ;

//Printing decrypted merchant Key
                System.out.println("Decrypted Merchant Key : " +  decryptedMerchantKey);
                String stringToDecrypt = "PxrEn69MEqvE4rGLFnQoxZl6VAbbxVvQp2bPrDKxANM=";//String to decrypt

//printing decrypted password using merchant key

                System.out.println("Decrypted String : " + AES128Cryptx.decrypt(stringToDecrypt,decryptedMerchantKey,false));

        }
}