public class JCESecurityModule extends BaseSMAdapter<SecureDESKey>
It doesn't require any hardware device to work.
JCESecurityModule also implements the SMAdapter, so you can view it: either
as a self contained security module adapter that doesn't need a security module
or a security module that plugs directly to jpos, so doesn't need
a separate adapter.
It relies on Java(tm) Cryptography Extension (JCE), hence its name.
JCESecurityModule relies on the JCEHandler class to do the low level JCE work.
WARNING: This version of JCESecurityModule is meant for testing purposes and NOT for life operation, since the Local Master Keys are stored in CLEAR on the system's disk. Comming versions of JCESecurity Module will rely on java.security.KeyStore for a better protection of the Local Master Keys.
| Modifier and Type | Field and Description |
|---|---|
protected JCEHandler |
jceHandler |
cfg, logger, realmFORMAT00, FORMAT01, FORMAT02, FORMAT03, FORMAT04, FORMAT05, FORMAT34, FORMAT35, FORMAT41, FORMAT42, LENGTH_DES, LENGTH_DES3_2KEY, LENGTH_DES3_3KEY, TYPE_BDK, TYPE_CVK, TYPE_DEK, TYPE_HMAC, TYPE_MK_AC, TYPE_MK_CVC3, TYPE_MK_DAC, TYPE_MK_DN, TYPE_MK_SMC, TYPE_MK_SMI, TYPE_PVK, TYPE_RSA_PK, TYPE_RSA_SK, TYPE_TAK, TYPE_TMK, TYPE_TPK, TYPE_ZAK, TYPE_ZEK, TYPE_ZMK, TYPE_ZPK| Constructor and Description |
|---|
JCESecurityModule()
Creates an uninitialized JCE Security Module, you need to setConfiguration to initialize it
|
JCESecurityModule(Configuration cfg,
Logger logger,
java.lang.String realm) |
JCESecurityModule(java.lang.String lmkFile) |
JCESecurityModule(java.lang.String lmkFile,
java.lang.String jceProviderClassName) |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
calculateARPC(java.security.Key skarpc,
byte[] arqc,
ARPCMethod arpcMethod,
byte[] arc,
byte[] propAuthData)
Calculate ARPC.
|
protected byte[] |
calculateARQC(MKDMethod mkdm,
SKDMethod skdm,
SecureDESKey imkac,
java.lang.String accountNo,
java.lang.String accntSeqNo,
byte[] atc,
byte[] upn,
byte[] transData)
Calculate ARQC.
|
protected java.lang.String |
calculateCAVVImpl(java.lang.String accountNo,
SecureDESKey cvk,
java.lang.String upn,
java.lang.String authrc,
java.lang.String sfarc)
Your SMAdapter should override this method if it has this functionality
|
protected java.lang.String |
calculateCVC3(SecureDESKey imkcvc3,
java.lang.String accountNo,
java.lang.String acctSeqNo,
byte[] atc,
byte[] upn,
byte[] data,
MKDMethod mkdm) |
protected java.lang.String |
calculateCVD(java.lang.String accountNo,
java.security.Key cvk,
java.lang.String expDate,
java.lang.String serviceCode) |
protected java.lang.String |
calculateCVDImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.lang.String expDate,
java.lang.String serviceCode)
Your SMAdapter should override this method if it has this functionality
|
protected java.lang.String |
calculateCVV(java.lang.String accountNo,
java.security.Key cvk,
java.util.Date expDate,
java.lang.String serviceCode) |
protected java.lang.String |
calculateCVVImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.util.Date expDate,
java.lang.String serviceCode)
Your SMAdapter should override this method if it has this functionality
|
protected java.lang.String |
calculatedCVV(java.lang.String accountNo,
SecureDESKey imkac,
java.lang.String expDate,
java.lang.String serviceCode,
byte[] atc,
MKDMethod mkdm) |
protected byte[] |
calculateDerivedKey(KeySerialNumber ksn,
SecureDESKey bdk,
boolean tdes,
boolean dataEncryption) |
protected byte[] |
calculateKeyCheckValue(java.security.Key key)
Calculates a key check value over a clear key
|
protected java.lang.String |
calculatePIN(byte[] pinBlock,
byte pinBlockFormat,
java.lang.String accountNumber)
Calculates the clear pin (as entered by card holder on the pin entry device)
givin the clear PIN block
|
protected byte[] |
calculatePINBlock(java.lang.String pin,
byte pinBlockFormat,
java.lang.String accountNumber)
Calculates the clear PIN Block
|
protected java.lang.String |
calculatePVV(EncryptedPIN pinUnderLmk,
java.security.Key key,
int keyIdx,
java.util.List<java.lang.String> excludes) |
protected java.lang.String |
calculatePVVImpl(EncryptedPIN pinUnderLmk,
SecureDESKey pvkA,
SecureDESKey pvkB,
int pvkIdx,
java.util.List<java.lang.String> excludes)
Your SMAdapter should override this method if it has this functionality
|
protected java.lang.String |
calculatePVVImpl(EncryptedPIN pinUnderKd1,
SecureDESKey kd1,
SecureDESKey pvkA,
SecureDESKey pvkB,
int pvkIdx,
java.util.List<java.lang.String> excludes)
Your SMAdapter should override this method if it has this functionality
|
protected void |
checkCAVVArgs(java.lang.String upn,
java.lang.String authrc,
java.lang.String sfarc) |
protected java.security.Key |
concatKeys(SecureDESKey keyA,
SecureDESKey keyB) |
byte[] |
dataDecrypt(SecureDESKey bdk,
byte[] cypherText)
Decrypt Data
|
byte[] |
dataEncrypt(SecureDESKey bdk,
byte[] clearText)
Encrypt Data
|
byte[] |
decryptDataImpl(CipherMode cipherMode,
SecureDESKey kd,
byte[] data,
byte[] iv)
Your SMAdapter should override this method if it has this functionality
|
protected java.security.Key |
decryptFromLMK(SecureDESKey secureDESKey)
Decrypts a secure DES key from encryption under LMK
|
java.lang.String |
decryptPINImpl(EncryptedPIN pinUnderLmk)
Your SMAdapter should override this method if it has this functionality
|
protected java.security.Key |
deriveICCMasterKey(java.security.Key imk,
byte[] panpsn)
Derive ICC Master Key from Issuer Master Key and preformated PAN/PANSeqNo
Compute two 8-byte numbers:
left part is a result of Tripple-DES encription
panpsn
with imk as the key
right part is a result of Tripple-DES binary inverted
panpsn with imk as the key
concatenate left and right parts
Described in EMV v4.2 Book 2, Annex A1.4.1 Master Key Derivation point 2 |
byte[] |
encryptDataImpl(CipherMode cipherMode,
SecureDESKey kd,
byte[] data,
byte[] iv)
Your SMAdapter should override this method if it has this functionality
|
EncryptedPIN |
encryptPINImpl(java.lang.String pin,
java.lang.String accountNumber)
Your SMAdapter should override this method if it has this functionality
|
protected EncryptedPIN |
encryptPINImpl(java.lang.String pin,
java.lang.String accountNumber,
SecureDESKey pek)
Your SMAdapter should override this method if it has this functionality.
|
protected SecureDESKey |
encryptToLMK(short keyLength,
java.lang.String keyType,
java.security.Key clearDESKey)
Encrypts a clear DES Key under LMK to form a SecureKey
|
byte[] |
exportKeyImpl(SecureDESKey key,
SecureDESKey kek)
Your SMAdapter should override this method if it has this functionality
|
EncryptedPIN |
exportPIN(EncryptedPIN pinUnderLmk,
KeySerialNumber ksn,
SecureDESKey bdk,
boolean tdes,
byte destinationPINBlockFormat)
Exports PIN to DUKPT Encryption.
|
EncryptedPIN |
exportPINImpl(EncryptedPIN pinUnderLmk,
SecureDESKey kd2,
byte destinationPINBlockFormat)
Your SMAdapter should override this method if it has this functionality
|
SecureDESKey |
formKEYfromClearComponents(short keyLength,
java.lang.String keyType,
java.lang.String... components)
Forms a key from 3 clear components and returns it encrypted under its corresponding LMK
The corresponding LMK is determined from the keyType
|
SecureDESKey |
formKEYfromThreeClearComponents(short keyLength,
java.lang.String keyType,
java.lang.String clearComponent1HexString,
java.lang.String clearComponent2HexString,
java.lang.String clearComponent3HexString)
Forms a key from 3 clear components and returns it encrypted under its corresponding LMK
The corresponding LMK is determined from the keyType
|
byte[] |
generateARPCImpl(MKDMethod mkdm,
SKDMethod skdm,
SecureDESKey imkac,
java.lang.String accountNo,
java.lang.String accntSeqNo,
byte[] arqc,
byte[] atc,
byte[] upn,
ARPCMethod arpcMethod,
byte[] arc,
byte[] propAuthData)
Your SMAdapter should override this method if it has this functionality
|
protected byte[] |
generateCBC_MACImpl(byte[] data,
SecureDESKey kd)
Generates CBC-MAC (Cipher Block Chaining Message Authentication Code)
for some data.
|
java.lang.String |
generateClearKeyComponent(short keyLength)
Generates a random clear key component.
|
protected byte[] |
generateEDE_MACImpl(byte[] data,
SecureDESKey kd)
Generates EDE-MAC (Encrypt Decrypt Encrypt Message Authentication Code)
for some data.
|
protected byte[] |
generateKeyCheckValueImpl(SecureDESKey secureDESKey)
Generates key check value.
|
SecureDESKey |
generateKeyImpl(short keyLength,
java.lang.String keyType)
Your SMAdapter should override this method if it has this functionality
|
EncryptedPIN |
generatePINImpl(java.lang.String accountNumber,
int pinLen,
java.util.List<java.lang.String> excludes)
Your SMAdapter should override this method if it has this functionality
|
protected byte[] |
generateSM_MACImpl(MKDMethod mkdm,
SKDMethod skdm,
SecureDESKey imksmi,
java.lang.String accountNo,
java.lang.String accntSeqNo,
byte[] atc,
byte[] arqc,
byte[] data)
Your SMAdapter should override this method if it has this functionality
|
SecureDESKey |
importBDK(java.lang.String clearComponent1HexString,
java.lang.String clearComponent2HexString,
java.lang.String clearComponent3HexString) |
SecureDESKey |
importKeyImpl(short keyLength,
java.lang.String keyType,
byte[] encryptedKey,
SecureDESKey kek,
boolean checkParity)
Your SMAdapter should override this method if it has this functionality
|
protected EncryptedPIN |
importPINImpl(EncryptedPIN pinUnderDuk,
KeySerialNumber ksn,
SecureDESKey bdk,
boolean tdes)
Your SMAdapter should override this method if it has this functionality
|
EncryptedPIN |
importPINImpl(EncryptedPIN pinUnderKd1,
SecureDESKey kd1)
Your SMAdapter should override this method if it has this functionality
|
void |
setConfiguration(Configuration cfg)
Configures a JCESecurityModule
|
protected byte[] |
specialDecrypt(byte[] data,
byte[] key) |
protected byte[] |
specialEncrypt(byte[] data,
byte[] key) |
SecureDESKey |
translateKeySchemeImpl(SecureDESKey key,
KeyScheme keyScheme)
Your SMAdapter should override this method if it has this functionality
|
protected org.javatuples.Pair<EncryptedPIN,byte[]> |
translatePINGenerateSM_MACImpl(MKDMethod mkdm,
SKDMethod skdm,
PaddingMethod padm,
SecureDESKey imksmi,
java.lang.String accountNo,
java.lang.String accntSeqNo,
byte[] atc,
byte[] arqc,
byte[] data,
EncryptedPIN currentPIN,
EncryptedPIN newPIN,
SecureDESKey kd1,
SecureDESKey imksmc,
SecureDESKey imkac,
byte destinationPINBlockFormat)
Your SMAdapter should override this method if it has this functionality
|
protected EncryptedPIN |
translatePINImpl(EncryptedPIN pinUnderDuk,
KeySerialNumber ksn,
SecureDESKey bdk,
SecureDESKey kd2,
byte destinationPINBlockFormat,
boolean tdes)
Your SMAdapter should override this method if it has this functionality
|
EncryptedPIN |
translatePINImpl(EncryptedPIN pinUnderKd1,
SecureDESKey kd1,
SecureDESKey kd2,
byte destinationPINBlockFormat)
Your SMAdapter should override this method if it has this functionality
|
byte[] |
verifyARQCGenerateARPCImpl(MKDMethod mkdm,
SKDMethod skdm,
SecureDESKey imkac,
java.lang.String accountNo,
java.lang.String accntSeqNo,
byte[] arqc,
byte[] atc,
byte[] upn,
byte[] transData,
ARPCMethod arpcMethod,
byte[] arc,
byte[] propAuthData)
Your SMAdapter should override this method if it has this functionality
|
protected boolean |
verifyARQCImpl(MKDMethod mkdm,
SKDMethod skdm,
SecureDESKey imkac,
java.lang.String accountNo,
java.lang.String accntSeqNo,
byte[] arqc,
byte[] atc,
byte[] upn,
byte[] transData)
Your SMAdapter should override this method if it has this functionality
|
protected boolean |
verifyCAVVImpl(java.lang.String accountNo,
SecureDESKey cvk,
java.lang.String cavv,
java.lang.String upn,
java.lang.String authrc,
java.lang.String sfarc)
Your SMAdapter should override this method if it has this functionality
|
protected boolean |
verifyCVC3Impl(SecureDESKey imkcvc3,
java.lang.String accountNo,
java.lang.String acctSeqNo,
byte[] atc,
byte[] upn,
byte[] data,
MKDMethod mkdm,
java.lang.String cvc3)
Your SMAdapter should override this method if it has this functionality
|
protected boolean |
verifyCVVImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.lang.String cvv,
java.util.Date expDate,
java.lang.String serviceCode)
Your SMAdapter should override this method if it has this functionality
|
protected boolean |
verifyCVVImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.lang.String cvv,
java.lang.String expDate,
java.lang.String serviceCode)
Your SMAdapter should override this method if it has this functionality
|
protected boolean |
verifydCVVImpl(java.lang.String accountNo,
SecureDESKey imkac,
java.lang.String dcvv,
java.util.Date expDate,
java.lang.String serviceCode,
byte[] atc,
MKDMethod mkdm)
Your SMAdapter should override this method if it has this functionality
|
protected boolean |
verifydCVVImpl(java.lang.String accountNo,
SecureDESKey imkac,
java.lang.String dcvv,
java.lang.String expDate,
java.lang.String serviceCode,
byte[] atc,
MKDMethod mkdm)
Your SMAdapter should override this method if it has this functionality
|
boolean |
verifyPVVImpl(EncryptedPIN pinUnderKd1,
SecureDESKey kd1,
SecureDESKey pvkA,
SecureDESKey pvkB,
int pvki,
java.lang.String pvv)
Your SMAdapter should override this method if it has this functionality
|
calculateCAVV, calculateCVD, calculateCVV, calculateIBMPINOffset, calculateIBMPINOffset, calculateIBMPINOffset, calculateIBMPINOffset, calculateIBMPINOffsetImpl, calculateIBMPINOffsetImpl, calculatePVV, calculatePVV, calculatePVV, calculatePVV, calculateSignature, calculateSignatureImpl, decryptData, decryptData, decryptDataImpl, decryptPIN, deriveIBMPIN, deriveIBMPINImpl, encryptData, encryptData, encryptDataImpl, encryptPIN, encryptPIN, encryptPIN, eraseOldLMK, eraseOldLMKImpl, exportKey, exportKey, exportKeyImpl, exportPIN, generateARPC, generateCBC_MAC, generateEDE_MAC, generateKey, generateKey, generateKeyCheckValue, generateKeyImpl, generateKeyPair, generateKeyPair, generateKeyPairImpl, generateKeyPairImpl, generatePIN, generatePIN, generateSM_MAC, getLogger, getName, getRealm, getSMAdapter, importKey, importKey, importKeyImpl, importPIN, importPIN, importPIN, importPINImpl, printPIN, printPINImpl, setLogger, setName, translateKeyFromOldLMK, translateKeyFromOldLMK, translateKeyFromOldLMKImpl, translateKeyFromOldLMKImpl, translateKeyScheme, translatePIN, translatePIN, translatePIN, translatePINGenerateSM_MAC, translatePINImpl, verifyARQC, verifyARQCGenerateARPC, verifyCAVV, verifyCVC3, verifyCVD, verifyCVV, verifydCVV, verifydCVV, verifyIBMPINOffset, verifyIBMPINOffsetImpl, verifyPVVprotected JCEHandler jceHandler
public JCESecurityModule()
public JCESecurityModule(java.lang.String lmkFile)
throws SMException
lmkFile - Local Master Keys filename of the JCE Security ModuleSMExceptionpublic JCESecurityModule(java.lang.String lmkFile,
java.lang.String jceProviderClassName)
throws SMException
SMExceptionpublic JCESecurityModule(Configuration cfg, Logger logger, java.lang.String realm) throws ConfigurationException
ConfigurationExceptionpublic void setConfiguration(Configuration cfg) throws ConfigurationException
setConfiguration in interface ConfigurablesetConfiguration in class BaseSMAdapter<SecureDESKey>cfg - The following properties are read:ConfigurationExceptionpublic SecureDESKey generateKeyImpl(short keyLength, java.lang.String keyType) throws SMException
BaseSMAdaptergenerateKeyImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic SecureDESKey importKeyImpl(short keyLength, java.lang.String keyType, byte[] encryptedKey, SecureDESKey kek, boolean checkParity) throws SMException
BaseSMAdapterimportKeyImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic byte[] exportKeyImpl(SecureDESKey key, SecureDESKey kek) throws SMException
BaseSMAdapterexportKeyImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic EncryptedPIN encryptPINImpl(java.lang.String pin, java.lang.String accountNumber) throws SMException
BaseSMAdapterencryptPINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected EncryptedPIN encryptPINImpl(java.lang.String pin, java.lang.String accountNumber, SecureDESKey pek) throws SMException
BaseSMAdapterencryptPINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic java.lang.String decryptPINImpl(EncryptedPIN pinUnderLmk) throws SMException
BaseSMAdapterdecryptPINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic EncryptedPIN importPINImpl(EncryptedPIN pinUnderKd1, SecureDESKey kd1) throws SMException
BaseSMAdapterimportPINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic EncryptedPIN exportPINImpl(EncryptedPIN pinUnderLmk, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException
BaseSMAdapterexportPINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic EncryptedPIN generatePINImpl(java.lang.String accountNumber, int pinLen, java.util.List<java.lang.String> excludes) throws SMException
BaseSMAdaptergeneratePINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected java.security.Key concatKeys(SecureDESKey keyA, SecureDESKey keyB) throws SMException
SMExceptionprotected java.lang.String calculateCVV(java.lang.String accountNo,
java.security.Key cvk,
java.util.Date expDate,
java.lang.String serviceCode)
throws SMException
SMExceptionprotected java.lang.String calculateCVD(java.lang.String accountNo,
java.security.Key cvk,
java.lang.String expDate,
java.lang.String serviceCode)
throws SMException
SMExceptionprotected java.lang.String calculateCVVImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.util.Date expDate,
java.lang.String serviceCode)
throws SMException
BaseSMAdaptercalculateCVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected java.lang.String calculateCVDImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.lang.String expDate,
java.lang.String serviceCode)
throws SMException
BaseSMAdaptercalculateCVDImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected void checkCAVVArgs(java.lang.String upn,
java.lang.String authrc,
java.lang.String sfarc)
throws SMException
SMExceptionprotected java.lang.String calculateCAVVImpl(java.lang.String accountNo,
SecureDESKey cvk,
java.lang.String upn,
java.lang.String authrc,
java.lang.String sfarc)
throws SMException
BaseSMAdaptercalculateCAVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected boolean verifyCVVImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.lang.String cvv,
java.util.Date expDate,
java.lang.String serviceCode)
throws SMException
BaseSMAdapterverifyCVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected boolean verifyCVVImpl(java.lang.String accountNo,
SecureDESKey cvkA,
SecureDESKey cvkB,
java.lang.String cvv,
java.lang.String expDate,
java.lang.String serviceCode)
throws SMException
BaseSMAdapterverifyCVVImpl in class BaseSMAdapter<SecureDESKey>true if CVV/CVC is valid or false otherwiseSMExceptionprotected boolean verifyCAVVImpl(java.lang.String accountNo,
SecureDESKey cvk,
java.lang.String cavv,
java.lang.String upn,
java.lang.String authrc,
java.lang.String sfarc)
throws SMException
BaseSMAdapterverifyCAVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected java.lang.String calculatedCVV(java.lang.String accountNo,
SecureDESKey imkac,
java.lang.String expDate,
java.lang.String serviceCode,
byte[] atc,
MKDMethod mkdm)
throws SMException
SMExceptionprotected boolean verifydCVVImpl(java.lang.String accountNo,
SecureDESKey imkac,
java.lang.String dcvv,
java.util.Date expDate,
java.lang.String serviceCode,
byte[] atc,
MKDMethod mkdm)
throws SMException
BaseSMAdapterverifydCVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected boolean verifydCVVImpl(java.lang.String accountNo,
SecureDESKey imkac,
java.lang.String dcvv,
java.lang.String expDate,
java.lang.String serviceCode,
byte[] atc,
MKDMethod mkdm)
throws SMException
BaseSMAdapterverifydCVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected java.lang.String calculateCVC3(SecureDESKey imkcvc3, java.lang.String accountNo, java.lang.String acctSeqNo, byte[] atc, byte[] upn, byte[] data, MKDMethod mkdm) throws SMException
SMExceptionprotected boolean verifyCVC3Impl(SecureDESKey imkcvc3, java.lang.String accountNo, java.lang.String acctSeqNo, byte[] atc, byte[] upn, byte[] data, MKDMethod mkdm, java.lang.String cvc3) throws SMException
BaseSMAdapterverifyCVC3Impl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected java.security.Key deriveICCMasterKey(java.security.Key imk,
byte[] panpsn)
throws JCEHandlerException
panpsn
with imk as the key
panpsn with imk as the key
imk - 16-bytes Issuer Master Keypanpsn - preformated PAN and PAN Sequence NumberJCEHandlerExceptionprotected java.lang.String calculatePVV(EncryptedPIN pinUnderLmk, java.security.Key key, int keyIdx, java.util.List<java.lang.String> excludes) throws SMException
SMExceptionprotected java.lang.String calculatePVVImpl(EncryptedPIN pinUnderLmk, SecureDESKey pvkA, SecureDESKey pvkB, int pvkIdx, java.util.List<java.lang.String> excludes) throws SMException
BaseSMAdaptercalculatePVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected java.lang.String calculatePVVImpl(EncryptedPIN pinUnderKd1, SecureDESKey kd1, SecureDESKey pvkA, SecureDESKey pvkB, int pvkIdx, java.util.List<java.lang.String> excludes) throws SMException
BaseSMAdaptercalculatePVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic boolean verifyPVVImpl(EncryptedPIN pinUnderKd1, SecureDESKey kd1, SecureDESKey pvkA, SecureDESKey pvkB, int pvki, java.lang.String pvv) throws SMException
BaseSMAdapterverifyPVVImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic EncryptedPIN translatePINImpl(EncryptedPIN pinUnderKd1, SecureDESKey kd1, SecureDESKey kd2, byte destinationPINBlockFormat) throws SMException
BaseSMAdaptertranslatePINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected byte[] calculateARQC(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imkac, java.lang.String accountNo, java.lang.String accntSeqNo, byte[] atc, byte[] upn, byte[] transData) throws SMException
Entry point e.g. for simulator systems
SMExceptionprotected boolean verifyARQCImpl(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imkac, java.lang.String accountNo, java.lang.String accntSeqNo, byte[] arqc, byte[] atc, byte[] upn, byte[] transData) throws SMException
BaseSMAdapterverifyARQCImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic byte[] generateARPCImpl(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imkac, java.lang.String accountNo, java.lang.String accntSeqNo, byte[] arqc, byte[] atc, byte[] upn, ARPCMethod arpcMethod, byte[] arc, byte[] propAuthData) throws SMException
BaseSMAdaptergenerateARPCImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic byte[] verifyARQCGenerateARPCImpl(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imkac, java.lang.String accountNo, java.lang.String accntSeqNo, byte[] arqc, byte[] atc, byte[] upn, byte[] transData, ARPCMethod arpcMethod, byte[] arc, byte[] propAuthData) throws SMException
BaseSMAdapterverifyARQCGenerateARPCImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected byte[] calculateARPC(java.security.Key skarpc,
byte[] arqc,
ARPCMethod arpcMethod,
byte[] arc,
byte[] propAuthData)
throws SMException
Entry point e.g. for simulator systems
SMExceptionprotected byte[] generateSM_MACImpl(MKDMethod mkdm, SKDMethod skdm, SecureDESKey imksmi, java.lang.String accountNo, java.lang.String accntSeqNo, byte[] atc, byte[] arqc, byte[] data) throws SMException
BaseSMAdaptergenerateSM_MACImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected org.javatuples.Pair<EncryptedPIN,byte[]> translatePINGenerateSM_MACImpl(MKDMethod mkdm, SKDMethod skdm, PaddingMethod padm, SecureDESKey imksmi, java.lang.String accountNo, java.lang.String accntSeqNo, byte[] atc, byte[] arqc, byte[] data, EncryptedPIN currentPIN, EncryptedPIN newPIN, SecureDESKey kd1, SecureDESKey imksmc, SecureDESKey imkac, byte destinationPINBlockFormat) throws SMException
BaseSMAdaptertranslatePINGenerateSM_MACImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic byte[] encryptDataImpl(CipherMode cipherMode, SecureDESKey kd, byte[] data, byte[] iv) throws SMException
BaseSMAdapterencryptDataImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic byte[] decryptDataImpl(CipherMode cipherMode, SecureDESKey kd, byte[] data, byte[] iv) throws SMException
BaseSMAdapterdecryptDataImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected byte[] generateCBC_MACImpl(byte[] data,
SecureDESKey kd)
throws SMException
generateCBC_MACImpl in class BaseSMAdapter<SecureDESKey>data - the data to be MACedkd - the key used for MACingSMExceptionprotected byte[] generateEDE_MACImpl(byte[] data,
SecureDESKey kd)
throws SMException
generateEDE_MACImpl in class BaseSMAdapter<SecureDESKey>data - the data to be MACedkd - the key used for MACingSMExceptionpublic java.lang.String generateClearKeyComponent(short keyLength)
throws SMException
keyLength - SMExceptionprotected byte[] generateKeyCheckValueImpl(SecureDESKey secureDESKey) throws SMException
generateKeyCheckValueImpl in class BaseSMAdapter<SecureDESKey>secureDESKey - SecureDESKey with untrusted or fake Key Check ValueSMExceptionpublic SecureDESKey translateKeySchemeImpl(SecureDESKey key, KeyScheme keyScheme) throws SMException
BaseSMAdaptertranslateKeySchemeImpl in class BaseSMAdapter<SecureDESKey>destKeyScheme schemeSMExceptionpublic SecureDESKey formKEYfromThreeClearComponents(short keyLength, java.lang.String keyType, java.lang.String clearComponent1HexString, java.lang.String clearComponent2HexString, java.lang.String clearComponent3HexString) throws SMException
keyLength - e.g. LENGTH_DES, LENGTH_DES3_2, LENGTH_DES3_3, ..keyType - possible values are those defined in the SecurityModule inteface. e.g., ZMK, TMK,...clearComponent1HexString - HexString containing the first componentclearComponent2HexString - HexString containing the second componentclearComponent3HexString - HexString containing the second componentSMExceptionpublic SecureDESKey formKEYfromClearComponents(short keyLength, java.lang.String keyType, java.lang.String... components) throws SMException
SMAdapterformKEYfromClearComponents in interface SMAdapter<SecureDESKey>formKEYfromClearComponents in class BaseSMAdapter<SecureDESKey>keyLength - e.g. LENGTH_DES, LENGTH_DES3_2, LENGTH_DES3_3, ..keyType - possible values are those defined in the SecurityModule inteface. e.g., ZMK, TMK,...components - up to three HexStrings containing key componentsSMExceptionprotected byte[] calculateKeyCheckValue(java.security.Key key)
throws SMException
key - SMExceptionprotected SecureDESKey encryptToLMK(short keyLength, java.lang.String keyType, java.security.Key clearDESKey) throws SMException
keyLength - keyType - clearDESKey - SMExceptionprotected java.security.Key decryptFromLMK(SecureDESKey secureDESKey) throws SMException
secureDESKey - (Key under LMK)SMExceptionprotected byte[] calculatePINBlock(java.lang.String pin,
byte pinBlockFormat,
java.lang.String accountNumber)
throws SMException
pin - as entered by the card holder on the PIN entry devicepinBlockFormat - accountNumber - (the 12 right-most digits of the account number excluding the check digit)SMExceptionprotected java.lang.String calculatePIN(byte[] pinBlock,
byte pinBlockFormat,
java.lang.String accountNumber)
throws SMException
pinBlock - clear PIN BlockpinBlockFormat - accountNumber - SMExceptionprotected byte[] specialEncrypt(byte[] data,
byte[] key)
throws JCEHandlerException
JCEHandlerExceptionprotected byte[] specialDecrypt(byte[] data,
byte[] key)
throws JCEHandlerException
JCEHandlerExceptionpublic byte[] dataEncrypt(SecureDESKey bdk, byte[] clearText) throws SMException
SMAdapterdataEncrypt in interface SMAdapter<SecureDESKey>dataEncrypt in class BaseSMAdapter<SecureDESKey>bdk - base derivation keyclearText - clear TextSMExceptionpublic byte[] dataDecrypt(SecureDESKey bdk, byte[] cypherText) throws SMException
SMAdapterdataDecrypt in interface SMAdapter<SecureDESKey>dataDecrypt in class BaseSMAdapter<SecureDESKey>bdk - base derivation keycypherText - clear TextSMExceptionprotected byte[] calculateDerivedKey(KeySerialNumber ksn, SecureDESKey bdk, boolean tdes, boolean dataEncryption) throws SMException
SMExceptionpublic SecureDESKey importBDK(java.lang.String clearComponent1HexString, java.lang.String clearComponent2HexString, java.lang.String clearComponent3HexString) throws SMException
SMExceptionprotected EncryptedPIN translatePINImpl(EncryptedPIN pinUnderDuk, KeySerialNumber ksn, SecureDESKey bdk, SecureDESKey kd2, byte destinationPINBlockFormat, boolean tdes) throws SMException
BaseSMAdaptertranslatePINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionprotected EncryptedPIN importPINImpl(EncryptedPIN pinUnderDuk, KeySerialNumber ksn, SecureDESKey bdk, boolean tdes) throws SMException
BaseSMAdapterimportPINImpl in class BaseSMAdapter<SecureDESKey>SMExceptionpublic EncryptedPIN exportPIN(EncryptedPIN pinUnderLmk, KeySerialNumber ksn, SecureDESKey bdk, boolean tdes, byte destinationPINBlockFormat) throws SMException
pinUnderLmk - ksn - bdk - tdes - destinationPINBlockFormat - SMException