ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kyle Tippetts <ktippe...@darkcanyongroup.com>
Subject AMEX Credit Card Decryption Issue
Date Wed, 04 Oct 2006 21:59:13 GMT
All,

I am trying to migrate an OFBiz system from a September 2004 version  
to the latest svn version (452xxx). Whenever I try to display a  
customer profile, if the customer has an American Express card as a  
payment method, I get this error in the logs:

========================
Target exception: java.lang.IllegalArgumentException: fromHexString  
requires an even number of hex characters
(Sourced file: component://party/webapp/partymgr/WEB-INF/actions/ 
party/editpaymentmethod.bsh : Method Invocation  
PaymentWorker.getPaymentMethodAndRelated) (Error running BSH script  
at [component://party/webapp/partymgr/WEB-INF/actions/party/ 
editpaymentmethod.bsh], line [32]: Sourced file: component://party/ 
webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.bsh : Method  
Invocation PaymentWorker.getPaymentMethodAndRelated : at Line: 32 :  
in file: component://party/webapp/partymgr/WEB-INF/actions/party/ 
editpaymentmethod.bsh : PaymentWorker .getPaymentMethodAndRelated  
( request , partyId )
========================

Obviously that's because an AMEX number is only 15 digits (16-digit  
card numbers that are unencrypted work/display just fine).

I want to write a service that encrypts all of the card numbers and  
stores them back in the database, but when I get to an AMEX card, I  
get this error:

=========================
Problem decrypting field [CreditCard / cardNumber]
Exception: org.ofbiz.entity.EntityCryptoException
Message: Given final block not properly padded
---- stack trace  
---------------------------------------------------------------
org.ofbiz.entity.EntityCryptoException: Given final block not  
properly padded
org.ofbiz.entity.util.EntityCrypto.decrypt(EntityCrypto.java:90)
org.ofbiz.entity.GenericDelegator.decryptFields(GenericDelegator.java: 
2662)
org.ofbiz.entity.GenericDelegator.findByPrimaryKey 
(GenericDelegator.java:1245)
org.ofbiz.entity.GenericDelegator.findByPrimaryKey 
(GenericDelegator.java:1295)
org.ofbiz.accounting.payment.PaymentWorker.getPaymentMethodAndRelated 
(PaymentWorker.java:141)
=========================

And of course, that's because the AMEX number is 15 digits, and the  
decrypt method is expecting something with 16 digits.

I'm in the process of stepping through the code to figure it out, but  
in the meanwhile, has anyone encountered and dealt with this already?

Thanks,
--Kyle
====================================
--Kyle Tippetts
--ktippetts@darkcanyongroup.com
--801 360 2348




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message