| java.lang.Object org.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi
ValueLinkApi | public class ValueLinkApi (Code) | | ValueLinkApi - Implementation of ValueLink Encryption & Transport
author: Andy Zeneski version: $Revision: 1.6 $ since: 3.0 |
Method Summary | |
public static byte[] | copyBytes(byte[] source, byte[] target, int position) | public KeyPair | createKeys() | protected byte[] | cryptoViaKek(byte[] content, int mode) | public String | decryptPin(String pin) | public byte[] | decryptViaKek(byte[] content) | public String | encryptPin(String pin) | public byte[] | encryptViaKek(byte[] content) | public byte[] | generateKek(PrivateKey privateKey) | public byte[] | generateMwk() | public byte[] | generateMwk(byte[] desBytes) | public byte[] | generateMwk(SecretKey mwkdes3) | public String | getAmount(Double amount) | public Double | getAmount(String amount) | public static byte[] | getByteRange(byte[] bytes, int offset, int length) | protected Cipher | getCipher(SecretKey key, int mode) | public String | getCurrency(String currency) | protected DHParameterSpec | getDHParameterSpec() | public String | getDateString() | protected SecretKey | getDesEdeKey(byte[] rawKey) | public GenericValue | getGenericValue() | public Map | getInitialRequestMap(Map context) | public static ValueLinkApi | getInstance(GenericDelegator delegator, Properties props, boolean reload) | public static ValueLinkApi | getInstance(GenericDelegator delegator, Properties props) | protected byte[] | getKek() | protected SecretKey | getKekKey() | protected byte[] | getMwk() | protected SecretKey | getMwkKey() | protected byte[] | getPinCheckSum(byte[] pinBytes) | public PrivateKey | getPrivateKey() | protected byte[] | getPrivateKeyBytes() | protected byte[] | getRandomBytes(int length) | public PublicKey | getValueLinkPublicKey() | public Long | getWorkingKeyIndex() | public StringBuffer | outputKeyCreation(boolean kekOnly, String kekTest) | protected Map | parseResponse(String response) | public void | reload() | public Map | send(Map request) | public Map | send(String url, Map request) |
debug | protected boolean debug(Code) | | |
kek | protected SecretKey kek(Code) | | |
mwk | protected SecretKey mwk(Code) | | |
ValueLinkApi | protected ValueLinkApi()(Code) | | |
copyBytes | public static byte[] copyBytes(byte[] source, byte[] target, int position)(Code) | | Copies a byte[] into another byte[] starting at a specific position
Parameters: source - byte[] to copy from Parameters: target - byte[] coping into Parameters: position - the position on target where source will be copied to a new byte[] |
cryptoViaKek | protected byte[] cryptoViaKek(byte[] content, int mode)(Code) | | |
decryptPin | public String decryptPin(String pin)(Code) | | Decrypt an encrypted pin using the configured keys
Parameters: pin - Hex String of the encrypted pin (EAN) Plain text String of the pin |
decryptViaKek | public byte[] decryptViaKek(byte[] content)(Code) | | Ue the KEK to decrypt a value
Parameters: content - byte array to decrypt decrypted byte array |
encryptPin | public String encryptPin(String pin)(Code) | | Encrypt the defined pin using the configured keys
Parameters: pin - Plain text String of the pin Hex String of the encrypted pin (EAN) for transmission to ValueLink |
encryptViaKek | public byte[] encryptViaKek(byte[] content)(Code) | | Use the KEK to encrypt a value usually the MWK
Parameters: content - byte array to encrypt encrypted byte array |
generateMwk | public byte[] generateMwk()(Code) | | Generate a new MWK
Hex String of the new encrypted MWK ready for transmission to ValueLink |
generateMwk | public byte[] generateMwk(byte[] desBytes)(Code) | | Generate a new MWK
Parameters: desBytes - byte array of the DES key (24 bytes) Hex String of the new encrypted MWK ready for transmission to ValueLink |
generateMwk | public byte[] generateMwk(SecretKey mwkdes3)(Code) | | Generate a new MWK
Parameters: mwkdes3 - pre-generated DES3 SecretKey Hex String of the new encrypted MWK ready for transmission to ValueLink |
getAmount | public String getAmount(Double amount)(Code) | | Returns a ValueLink formatted amount String
Parameters: amount - Double value to format Formatted String |
getAmount | public Double getAmount(String amount)(Code) | | Returns a Double from a ValueLink formatted amount String
Parameters: amount - The ValueLink formatted amount String Double object |
getByteRange | public static byte[] getByteRange(byte[] bytes, int offset, int length)(Code) | | Returns a new byte[] from the offset of the defined byte[] with a specific number of bytes
Parameters: bytes - The byte[] to extract from Parameters: offset - The starting postition Parameters: length - The number of bytes to copy a new byte[] |
getCipher | protected Cipher getCipher(SecretKey key, int mode)(Code) | | |
getDHParameterSpec | protected DHParameterSpec getDHParameterSpec()(Code) | | |
getDateString | public String getDateString()(Code) | | Returns a date string formatted as directed by ValueLink
ValueLink formatted date String |
getDesEdeKey | protected SecretKey getDesEdeKey(byte[] rawKey)(Code) | | |
getGenericValue | public GenericValue getGenericValue()(Code) | | Gets the cached value object for this merchant's keys
Cached GenericValue object |
getInitialRequestMap | public Map getInitialRequestMap(Map context)(Code) | | Creates a Map of initial request values (MerchID, AltMerchNo, Modes, MerchTime, TermTxnNo, EncryptID)
Note: For 2010 (assign working key) transaction, the EncryptID will need to be adjusted
Map containing the inital request values |
getInstance | public static ValueLinkApi getInstance(GenericDelegator delegator, Properties props, boolean reload)(Code) | | Obtain an instance of the ValueLinkApi
Parameters: delegator - GenericDelegator used to query the encryption keys Parameters: props - Properties to use for the Api (usually payment.properties) Parameters: reload - When true, will replace an existing instance in the cache and reload all properties ValueLinkApi reference |
getInstance | public static ValueLinkApi getInstance(GenericDelegator delegator, Properties props)(Code) | | Obtain an instance of the ValueLinkApi; this method will always return an existing reference if one is available
Parameters: delegator - GenericDelegator used to query the encryption keys Parameters: props - Properties to use for the Api (usually payment.properties) |
getKek | protected byte[] getKek()(Code) | | |
getKekKey | protected SecretKey getKekKey()(Code) | | |
getMwk | protected byte[] getMwk()(Code) | | |
getMwkKey | protected SecretKey getMwkKey()(Code) | | |
getPinCheckSum | protected byte[] getPinCheckSum(byte[] pinBytes)(Code) | | |
getPrivateKeyBytes | protected byte[] getPrivateKeyBytes()(Code) | | |
getRandomBytes | protected byte[] getRandomBytes(int length)(Code) | | |
getWorkingKeyIndex | public Long getWorkingKeyIndex()(Code) | | Returns the current working key index
Long number of the current working key index |
outputKeyCreation | public StringBuffer outputKeyCreation(boolean kekOnly, String kekTest)(Code) | | Output the creation of public/private keys + KEK to the console for manual database update
|
reload | public void reload()(Code) | | Reloads the keys in the object cache; use this when re-creating keys
|
send | public Map send(String url, Map request) throws HttpClientException(Code) | | Transmit a request to ValueLink
Parameters: url - override URL from what is defined in the properties Parameters: request - request Map of request parameters Map of response parameters throws: HttpClientException - |
|
|