Java API Sample
This article provides a sample of Java API for tokenization and detokenization using CADP for Java.
String naeUser="vuser";
char[] naePswd="xxxxxxx".toCharArray();
String keyName="token_key";
TokenServiceVaultless ts=new TokenServiceVaultless(naeUser,naePswd,keyName);
TokenSpec spec=new TokenSpec();
spec.setFormat(ts.FIRST_SIX_TOKEN);
spec.setClearTextSensitive(false);
spec.setNonIdempotentTokens(false);
spec.setGroupID(1);
String token=ts.tokenize("3646436545758756", spec);
System.out.println(token);
String value=ts.detokenize(token/*as returned above*/, spec);
System.out.println(value);
ts.closeService();
Java API sample demonstrating use of AlgoSpec
String naeUser="vuser";
char[] naePswd="xxxxxxxx".toCharArray();
String keyName="token_key_svt";
AlgoSpec algospec=new AlgoSpec();
algospec.setVersion(1);
TokenServiceVaultless ts=new
TokenServiceVaultless(naeUser,naePswd,keyName,algospec);
TokenSpec spec=new TokenSpec();
spec.setFormat(ts.TOKEN_ALL);
spec.setNonIdempotentTokens(false);
spec.setGroupID(3);
String token=ts.tokenize("1637382992837337", spec );
System.out.println("Tokenized Value: "+ token);
String value=ts.detokenize(token, spec);
System.out.println("Detokenized Value: "+value);
ts.closeService();
Java API sample demonstrating tokenization and detokenization of Unicode characters
String naeUser="vuser";
char[] naePswd="xxxxxxx".toCharArray();
String keyName="token_key";
AlgoSpec algospec=new AlgoSpec();
algospec.setVersion(1);
algospec.setUnicode(AlgoSpec.UNICODE_HIRAGANA);
TokenServiceVaultless ts=new
TokenServiceVaultless(naeUser,naePswd,keyName,algospec);
TokenSpec spec=new TokenSpec();
spec.setFormat(ts.TOKEN_ALL);
spec.setGroupID(1);
// HIRAGANA Charset
String token=ts.tokenize("\u3042\u3064\u3076\u3089\u3075\u3090\u305F";, spec );
System.out.println("Tokenized Value: "+ token);
String detoken_value=ts.detokenize(token, spec);
System.out.println("Detokenized Value: "+ detoken_value);
ts.closeService();
Following is an example of tokenization and detokenization of Hiragana Unicode input character. The input value (\u3042\u3064\u3076\u3089\u3075\u3090\u305F) is passed in hexadecimal format. CADP for Java generates token for the input value and detokenizes it to its original value.