Glitch Posted November 8, 2016 Share Posted November 8, 2016 (edited) Hi - I've edited this post to reflect a solution. A little help from WHMCS support. This will create the database has, and decode the fields. I'm using this as an export prior to a change of payment gateways. This could also be the basis for an export of customers prior to changing the cc_encryption_hash (but dont forget service passwords too using the WHMCS decrypt() function)... $stmt = $pdo->prepare("SELECT id, firstname, lastname, companyname, email, address1, address2, city, state, postcode, phonenumber, cardtype, cardlastfour, AES_DECRYPT(cardnum, MD5(CONCAT('$cc_encryption_hash',id)) ) as cardnum, AES_DECRYPT(expdate, MD5(CONCAT('$cc_encryption_hash',id)) ) as expdate, AES_DECRYPT(issuenumber, MD5(CONCAT('$cc_encryption_hash',id)) ) as issuenumber, AES_DECRYPT(startdate, MD5(CONCAT('$cc_encryption_hash',id)) ) as startdate FROM tblclients "); $stmt->execute(); $lines = $stmt->rowCount(); $results = $stmt->fetchAll(PDO::FETCH_ASSOC); Edited November 9, 2016 by Glitch More detail 0 Quote Link to comment Share on other sites More sharing options...
Glitch Posted November 8, 2016 Author Share Posted November 8, 2016 So changing the SQL to this: $stmt = $pdo->prepare("SELECT id, firstname, lastname, companyname, email, address1, address2, city, state, postcode, phonenumber, cardtype, AES_DECRYPT(cardnum,'your hash') as cardnum, cardlastfour, AES_DECRYPT(expdate,'your hash' ) as expdate, AES_DECRYPT(issuenumber,'your hash' ) as issuenumber , AES_DECRYPT(startdate,'your hash') as startdate FROM tblclients "); $stmt->execute(); Results in things being decrypted, however "your hash" (32 Bytes) as supplied by WHMCS to the mysql backend is not the same as $cc_encryption_hash (64 bytes). Can anyone clue me in on what is being done to it? Like its a double-hash, or something else, but it would be handy if someone, even by PM could let me know what as that will save me a crap load of time. Cheers. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.