String with '-' or space doesn't work
johnwyz88 opened this issue · comments
For example, all of these fails to be encrypted.
@Param({
"driver licences 123456-789",
"ssn 841-01-2233",
"cc 5360888786433111",
"cell +1(416)-562-0165",
"email donald.duck@google.com",
"large json event",
})
java.lang.NumberFormatException: For input string: "c 5360"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Integer.parseInt(Integer.java:652)
at java.base/java.math.BigInteger.(BigInteger.java:543)
at com.amazon.awsstewardengine.FF3Cipher.encrypt(FF3Cipher.java:95)
java.lang.NumberFormatException: Illegal embedded sign character
at java.base/java.math.BigInteger.(BigInteger.java:492)
at com.amazon.awsstewardengine.FF3Cipher.encrypt(FF3Cipher.java:95)
Yes, it is correct that only numeric and mono-case US ASCII letters are supported (a-z) by default. The NIST FPE Feistel cipher has a 'radix' representing the range of characters. Special characters, or international characters are supported if you define an alphabet. However, the positional formatting would not be preserved. For example, a SSN using an alphabet with dashes could have a single dash, or five.
I would suggest you remove the formatting (dashes, spaces) before encryption, and re-apply formatting afterwards.