InsertBatch()
InsertBatch() encrypts an array of plaintext values, create tokens, and insert them into the token vault.
Syntax
public String[] InsertBatch (String naeUser, String naePassword, String dbUser, String dbPswd, String tableName, String[] values, Integer format, Boolean luhnCheck)
Request Parameters
Parameters | Data Types | Descriptions |
---|---|---|
naeUser | string | A Key Manager user with access to the AES and HMAC keys. |
naePassword | string | The Key Manager user’s password. |
dbUser | string | A database user with access to the token table. |
dbPswd | string | The database user’s password. |
tableName | string | This is the Token Vault name and it must be in CAPITAL LETTERS. |
values | string[] | String array of data to be tokenized. The resulting tokens can each be 20 characters long or less. |
format | integer | One of the predefined token formats or a format created using createNewFormat(). You can use the constant if your application imports com.safenet.token.TokenService. Otherwise, be sure to use the correct integer. Available formats and their corresponding integers are listed below. • 1 - TokenService.RANDOM_TOKEN • 2 - TokenService.SEQUENTIAL_TOKEN • 3 - TokenService.LAST_FOUR_TOKEN • 4 - TokenService.FIRST_SIX_TOKEN • 5 - TokenService.FIRST_TWO_LAST_FOUR_TOKEN • 7 - TokenService.FIRST_SIX_LAST_FOUR_TOKEN • 8 - TokenService.FIXED_NINETEEN_TOKEN • 9 - TokenService.FIXED_TWENTY_LAST_FOUR_TOKEN • 10 - TokenService.EMAIL_ADDRESS_TOKEN • 11 - TokenService.DATE_MMDDYYYY_TOKEN • 12 - TokenService.DATE_DDMMYYYY_TOKEN • 13 - TokenService.DATE_YYYYMMDD_TOKEN • 14 - TokenService.FIRST_SIX_LAST_FOUR_FAIL_LUHN_TOKEN • 15 - TokenService.FIXED_FIRST_TWO_LAST_FOUR_FAIL_LUHN_TOKEN • 16 - TokenService.SHA2_256_BASE16_TOKEN • 17 - TokenService.SHA2_384_BASE16_TOKEN • 18 - TokenService.SHA2_512_BASE16_TOKEN • 19 - TokenService.SHA2_256_ BASE64_TOKEN • 20 - TokenService.SHA2_384_ BASE64_TOKEN • 21 - TokenService.SHA2_512_ BASE64_TOKEN • 22 - TokenService.RANDOM_ALPHANUMERIC_TOKEN • 23 - TokenService.ALPHANUMERIC_TOKEN For more information about these formats, see [Using Token Formats]. |
luhnCheck | boolean | boolean indicates if the value must pass a Luhn check (true) or if there is no requirement (false). Token formats created using the createNewFormat() method may have one of three luhnCheck rules. The rules are must fail test, no requirement, and must pass test. |
The priority of the luhnCheck boolean in insert() and the luhnCheck integer in createNewFormat() vary depending on their values, as shown in the following figure:
Returned Values
A string array of the tokens.
Note
When using repeated calls to InsertBatch to create a large amount of tokens on a Microsoft Windows system, more than 8000 values for example, you may experience a connection failure if the operating system runs out of available sockets. You can avoid this error by creating registry entries for MaxUserPort (to increase the number of ports available) and TcpTimedWaitDelay (to specify the number of seconds that elapse before a socket is released and can be reused). These are both DWORD values.
Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters
. Add MaxUserPort and set it to 32678. Add TcpTimedWaitDelay and set it to 30.