📄 basesmadapter.java
字号:
} return result; } public EncryptedPIN translatePIN (EncryptedPIN pinUnderKd1, SecureDESKey kd1, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException { SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "PIN under Data Key 1", pinUnderKd1), new SimpleMsg("parameter", "Data Key 1", kd1), new SimpleMsg("parameter", "Data Key 2", kd2), new SimpleMsg("parameter", "Destination PIN Block Format", destinationPINBlockFormat) }; LogEvent evt = new LogEvent(this, "s-m-operation"); evt.addMessage(new SimpleMsg("command", "Translate PIN from Data Key 1 to Data Key 2", cmdParameters)); EncryptedPIN result = null; try { result = translatePINImpl(pinUnderKd1, kd1, kd2, destinationPINBlockFormat); evt.addMessage(new SimpleMsg("result", "PIN under Data Key 2", result)); } catch (Exception e) { evt.addMessage(e); throw e instanceof SMException ? (SMException) e : new SMException(e); } finally { Logger.log(evt); } return result; } public EncryptedPIN importPIN (EncryptedPIN pinUnderDuk, KeySerialNumber ksn, SecureDESKey bdk) throws SMException { SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "PIN under Derived Unique Key", pinUnderDuk), new SimpleMsg("parameter", "Key Serial Number", ksn), new SimpleMsg("parameter", "Base Derivation Key", bdk) }; LogEvent evt = new LogEvent(this, "s-m-operation"); evt.addMessage(new SimpleMsg("command", "Import PIN", cmdParameters)); EncryptedPIN result = null; try { result = importPINImpl(pinUnderDuk, ksn, bdk); evt.addMessage(new SimpleMsg("result", "PIN under LMK", result)); } catch (Exception e) { evt.addMessage(e); throw e instanceof SMException ? (SMException) e : new SMException(e); } finally { Logger.log(evt); } return result; } public EncryptedPIN translatePIN (EncryptedPIN pinUnderDuk, KeySerialNumber ksn, SecureDESKey bdk, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException { SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "PIN under Derived Unique Key", pinUnderDuk), new SimpleMsg("parameter", "Key Serial Number", ksn), new SimpleMsg("parameter", "Base Derivation Key", bdk), new SimpleMsg("parameter", "Data Key 2", kd2), new SimpleMsg("parameter", "Destination PIN Block Format", destinationPINBlockFormat) }; LogEvent evt = new LogEvent(this, "s-m-operation"); evt.addMessage(new SimpleMsg("command", "Translate PIN", cmdParameters)); EncryptedPIN result = null; try { result = translatePINImpl(pinUnderDuk, ksn, bdk, kd2, destinationPINBlockFormat); evt.addMessage(new SimpleMsg("result", "PIN under Data Key 2", result)); } catch (Exception e) { evt.addMessage(e); throw e instanceof SMException ? (SMException) e : new SMException(e); } finally { Logger.log(evt); } return result; } public EncryptedPIN exportPIN (EncryptedPIN pinUnderLmk, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException { SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "PIN under LMK", pinUnderLmk), new SimpleMsg("parameter", "Data Key 2", kd2), new SimpleMsg("parameter", "Destination PIN Block Format", destinationPINBlockFormat) }; LogEvent evt = new LogEvent(this, "s-m-operation"); evt.addMessage(new SimpleMsg("command", "Export PIN", cmdParameters)); EncryptedPIN result = null; try { result = exportPINImpl(pinUnderLmk, kd2, destinationPINBlockFormat); evt.addMessage(new SimpleMsg("result", "PIN under Data Key 2", result)); } catch (Exception e) { evt.addMessage(e); throw e instanceof SMException ? (SMException) e : new SMException(e); } finally { Logger.log(evt); } return result; } public byte[] generateCBC_MAC (byte[] data, SecureDESKey kd) throws SMException { SimpleMsg[] cmdParameters = { new SimpleMsg("parameter", "data", data), new SimpleMsg("parameter", "data key", kd), }; LogEvent evt = new LogEvent(this, "s-m-operation"); evt.addMessage(new SimpleMsg("command", "Generate CBC-MAC", cmdParameters)); byte[] result = null; try { result = generateCBC_MACImpl(data, kd); evt.addMessage(new SimpleMsg("result", "CBC-MAC", result)); } catch (Exception e) { evt.addMessage(e); throw e instanceof SMException ? (SMException) e : new SMException(e); } finally { Logger.log(evt); } return result; } /** * Your SMAdapter should override this method if it has this functionality * @param keyLength * @param keyType * @return generated key * @throws SMException */ protected SecureDESKey generateKeyImpl (short keyLength, String keyType) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param keyLength * @param keyType * @param encryptedKey * @param kek * @return imported key * @throws SMException */ protected SecureDESKey importKeyImpl (short keyLength, String keyType, byte[] encryptedKey, SecureDESKey kek, boolean checkParity) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param key * @param kek * @return exported key * @throws SMException */ protected byte[] exportKeyImpl (SecureDESKey key, SecureDESKey kek) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param pin * @param accountNumber * @return encrypted PIN under LMK * @throws SMException */ protected EncryptedPIN encryptPINImpl (String pin, String accountNumber) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param pinUnderLmk * @return clear pin as entered by card holder * @throws SMException */ protected String decryptPINImpl (EncryptedPIN pinUnderLmk) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param pinUnderKd1 * @param kd1 * @return imported pin * @throws SMException */ protected EncryptedPIN importPINImpl (EncryptedPIN pinUnderKd1, SecureDESKey kd1) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param pinUnderKd1 * @param kd1 * @param kd2 * @param destinationPINBlockFormat * @return translated pin * @throws SMException */ protected EncryptedPIN translatePINImpl (EncryptedPIN pinUnderKd1, SecureDESKey kd1, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param pinUnderDuk * @param ksn * @param bdk * @return imported pin * @throws SMException */ protected EncryptedPIN importPINImpl (EncryptedPIN pinUnderDuk, KeySerialNumber ksn, SecureDESKey bdk) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param pinUnderDuk * @param ksn * @param bdk * @param kd2 * @param destinationPINBlockFormat * @return translated pin * @throws SMException */ protected EncryptedPIN translatePINImpl (EncryptedPIN pinUnderDuk, KeySerialNumber ksn, SecureDESKey bdk, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param pinUnderLmk * @param kd2 * @param destinationPINBlockFormat * @return exported pin * @throws SMException */ protected EncryptedPIN exportPINImpl (EncryptedPIN pinUnderLmk, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); } /** * Your SMAdapter should override this method if it has this functionality * @param data * @param kd * @return generated CBC-MAC * @throws SMException */ protected byte[] generateCBC_MACImpl (byte[] data, SecureDESKey kd) throws SMException { throw new SMException("Operation not supported in: " + this.getClass().getName()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -