PINBLOCK不包含有效值

时间:2017-01-11 15:27:58

标签: hsm iso8583

在尝试运行事务时,我总是将此错误作为响应,同时使用正确的TPK加密我已经确认的PINBLOCK。 虽然,我不太确定的是用于加密这些数据的算法因此导致这个错误,因为,算法是预期的DES算法(来自给出的文档)正在提供已翻译的PINBlock:99-Wrong Format ,但在更新我的代码后才使用

public String do3DESEncryption(String key, String text) {
        String encryptedInfo = null;
        try {
            String key1 = key.substring(0, 16);
            String key2 = key.substring(16);
            encryptedInfo = doDESEncryption(key1, text);
            encryptedInfo = doDESDecryption(key2, encryptedInfo);
            encryptedInfo = doDESEncryption(key1, encryptedInfo);
        } catch (Exception ex) {
            System.out.println("do3DESEncryption error message"+ex.getMessage());
            ex.printStackTrace();
        }

        return encryptedInfo;
    }

我之前使用的算法如下所述

public String doDESEncryption(String key, String text) {
        String encryptedInfo = "";
        try {
            byte[] theCph = null;
            byte[] theKey = null;
            byte[] theMsg = null;
            theKey = hexToBytes(key);
            theMsg = hexToBytes(text);
            DESKeySpec ks = new DESKeySpec(theKey);
            SecretKeyFactory kf = SecretKeyFactory.getInstance("DES");
            SecretKey ky = kf.generateSecret(ks);
            Cipher cf = Cipher.getInstance("DES/ECB/NoPadding");
            cf.init(Cipher.ENCRYPT_MODE, ky);
            theCph = cf.doFinal(theMsg);
            encryptedInfo = bytesToHex(theCph);
            System.out.println("Just the ePINBLOCK"+encryptedInfo);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return encryptedInfo;
    }

我想知道,如果我实际上正在进行加密,那么我只能访问客户端。我只是想确定我在自己的目的所做的事情,并知道,如果有任何其他更正我可以做以避免得到这个错误。 translatedPINBlock:99-Wrong Format

这是第一台机器的错误日志

  

Postilion例外:[postilion.realtime.sdk.crypto.XPinLengthError]   描述:涉及密钥的加密操作()   ' SBP_KVP'失败,因为提供了无效数据。无效数据   在现场' PIN'。由于PIN长度,数据无效   无效。 ID:[126]数据:[无]

     

在   postilion.realtime.sdk.crypto.impl.rg7000.ARG7000KeyImpl.processErrorCode(ARG7000KeyImpl.java:170)   在   postilion.realtime.sdk.crypto.impl.rg7000.RG7000DesKeyImpl.processErrorCode(RG7000DesKeyImpl.java:1320)   在   postilion.realtime.sdk.crypto.impl.rg7000.RG7000DesKeyImpl.processResponseAndErrorCode(RG7000DesKeyImpl.java:1378)   在   postilion.realtime.sdk.crypto.impl.rg7000.RG7000DesKvpIbmImpl.verifyPin(RG7000DesKvpIbmImpl.java:365)   在   postilion.realtime.sdk.crypto.DesKvpIbm.verifyPin(DesKvpIbm.java:613)   在   postilion.postcard.authorizers.IBMPinVerificationData.verify(IBMPinVerificationData.java:281)   在   postilion.postcard.authorizers.validators.ValidatorPinPostCard.validatePin(ValidatorPinPostCard.java:550)   在   postilion.postcard.authorizers.validators.ValidatorPinPostCard.validatePinAndPopulateMessageReasonCode(ValidatorPinPostCard.java:281)   在   postilion.postcard.authorizers.validators.ValidatorPinPostCard.validateOnline(ValidatorPinPostCard.java:78)   在   postilion.postcard.authorizers.pipeline.adapter.IssuerValidatorAdapter.process(IssuerValidatorAdapter.java:117)   在   postilion.postcard.authorizers.pipeline.Pipeline.process(Pipeline.java:315)   在   postilion.postcard.authorizers.AuthorizerPostCard.authorizeRequestOnline(AuthorizerPostCard.java:339)   在   postilion.realtime.apps.tranmgr.EventHandlerReqReqMessage.attemptLocalAuthorization(EventHandlerReqReqMessage.java:145)   在   postilion.realtime.apps.tranmgr.EventHandlerTranReq.processTran(EventHandlerTranReq.java:88)   在   postilion.realtime.apps.tranmgr.EventHandlerMessage.process(EventHandlerMessage.java:64)   在   postilion.realtime.apps.tranmgr.EventHandlerMessage.processMsg(EventHandlerMessage.java:40)   在   postilion.realtime.apps.tranmgr.TransactionManager.processNodeMessage(TransactionManager.java:1435)   在   postilion.realtime.apps.tranmgr.TransactionManager.processEvent(TransactionManager.java:1360)   at postilion.realtime.sdk.util.Processor.run(Processor.java:213)at   postilion.realtime.sdk.env.AppProcessor.run(AppProcessor.java:136)   [错误事件126]

来自机器2的错误日志

  

:: process0200   messageRetrievedFromStore [51]:22314F270B978B54 INFO | jvm 1 |   2017/01/04 16:00:21 | 2017年1月4日下午4:00:21   hsmm.ncs.core.MessageProcessor processPINBlock INFO | jvm 1 |   2017/01/04 16:00:21 |信息:MessageProcessor :: process0200 ::

     
    
      
        
          
            
              
                
                  
                    
                      
                        
                          
                            
                              
                                
                                  
                                    
                                      
                                        
                                          
                                            
                                              
                                                

translatedPINBlock:99-Wrong Format INFO | jvm 1 | 2017/01/04 16:00:21 | 2017年1月4日下午4:00:21                                                 hsmm.ncs.core.MessageProcessor process0200

                                              
                                            
                                          
                                        
                                      
                                    
                                  
                                
                              
                            
                          
                        
                      
                    
                  
                
              
            
          
        
      
    
  

1 个答案:

答案 0 :(得分:1)

目前的做法要求加密为3DES,可能使用双倍长度密钥。