public class Token extends Object
Represents decrypted and parsed YubiKey OTP.
Modifier and Type | Field and Description |
---|---|
(package private) static int |
BLOCK_SIZE |
(package private) byte[] |
crc |
(package private) static int |
KEY_SIZE |
(package private) byte[] |
random |
(package private) byte[] |
sessionCounter |
(package private) byte |
timestampHigh |
(package private) byte[] |
timestampLow |
(package private) byte |
timesUsed |
(package private) byte[] |
uid |
(package private) static int |
UID_SIZE |
Constructor and Description |
---|
Token(byte[] b)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getCleanCounter()
Gets session counter bytes with cap-lock triggered bit cleared.
|
byte[] |
getCrc()
Gets reference to the CRC16 checksum of the OTP.
|
byte[] |
getRandom()
Gets reference to the random bytes of the OTP.
|
byte[] |
getSessionCounter()
Gets reference to byte sequence of session counter.
|
byte |
getTimestampHigh()
Gets high byte of time stamp.
|
byte[] |
getTimestampLow()
Gets reference to byte sequence of low part of time stamp.
|
byte |
getTimesUsed()
Gets byte value of counter that increases for each generated OTP during
a session.
|
byte[] |
getUid()
Gets reference to bytes making up secret id.
|
String |
toString() |
private static String |
toString(byte b) |
(package private) static String |
toString(byte[] b) |
boolean |
wasCapsLockOn()
Tells if triggered by caps lock.
|
static int BLOCK_SIZE
static int KEY_SIZE
static int UID_SIZE
byte[] uid
byte[] sessionCounter
byte[] timestampLow
byte timestampHigh
byte timesUsed
byte[] random
byte[] crc
public Token(byte[] b)
Constructor.
b
- Decrypted OTP to be parsed.IllegalArgumentException
- If b
not accepted as being a OTP.public byte[] getCrc()
Gets reference to the CRC16 checksum of the OTP.
This property is of little interest to other then unit test code since
the checksum was validated when constructing this
.
public byte[] getRandom()
Gets reference to the random bytes of the OTP.
This property is of little interest to other then unit test code.
public byte[] getUid()
Gets reference to bytes making up secret id.
public byte[] getSessionCounter()
Gets reference to byte sequence of session counter.
getCleanCounter()
public byte getTimestampHigh()
Gets high byte of time stamp.
public byte[] getTimestampLow()
Gets reference to byte sequence of low part of time stamp.
2
.private static String toString(byte b)
static String toString(byte[] b)
public byte[] getCleanCounter()
Gets session counter bytes with cap-lock triggered bit cleared.
public byte getTimesUsed()
Gets byte value of counter that increases for each generated OTP during a session.
public boolean wasCapsLockOn()
Tells if triggered by caps lock.
true
if, false
if not.Copyright © 2013 Yubico AB. All Rights Reserved.