public final class CapTools extends Object
Modifier and Type | Method and Description |
---|---|
static SecureString |
prefixSequenceNumberAsHexToOtp(SecureString otp,
CapToken token)
Prefix an OTP value with token's sequence number as hexadecimal digits.
|
static SecureString |
prefixSequenceNumberToOtp(SecureString otp,
CapToken token)
Prefix an OTP value with token's sequence number as decimal digits.
|
static SecureString |
prefixSequenceNumberToOtp(SecureString otp,
CapToken token,
int tokenVersionLength)
Prefix an OTP value with a token sequence number, zero padded to the left.
|
public static SecureString prefixSequenceNumberToOtp(SecureString otp, CapToken token, int tokenVersionLength)
Notice: The token sequence number is not defined for OATH tokens. All OATH token will share the same sequence number as 0xFF.
Warning! This method should be used when token has been provisioned with provisioning protocol v1.
otp
- OTP to prefix.token
- The token which generated the otp.tokenVersionLength
- Number of digits to prefix, if needed the tokenSequenceNumber
will be
zero padded to the left. Maximum length is 3, cannot be 0.
tokenVersionLength | Prefix range |
1 | 1 - 9 |
2 | 01 - 99 |
3 | 001 - 255 |
IllegalArgumentException
- When tokenSequenceNumber is invalid or the tokenVersionLength is less then the actual length of Sequence Number.public static SecureString prefixSequenceNumberToOtp(SecureString otp, CapToken token)
Notice: The token sequence number is not defined for OATH tokens. All OATH token will share the same sequence number as 0xFF.
Warning! This method should be used when token has been provisioned with provisioning protocol v1.
otp
- OTP to prefix.token
- The token which generated the otp. Only significant digits will be used.IllegalArgumentException
- When tokenSequenceNumber is invalid.public static SecureString prefixSequenceNumberAsHexToOtp(SecureString otp, CapToken token)
Notice: The token sequence number is not defined for OATH tokens. All OATH token will share the same sequence number as 0xFF.
Warning! This method should be used when token has been provisioned with provisioning protocol v2.
otp
- OTP to prefix.token
- The token which generated the otp. Only significant digits will be used.IllegalArgumentException
- When tokenSequenceNumber is invalid.