Class WfAuthToken
java.lang.Object
org.whiteflagprotocol.java.crypto.WfAuthToken
- All Implemented Interfaces:
Destroyable
Whiteflag authentication token class
This class represents a Whiteflag shared secret authentication token. Instances of this class represent the shared secret, and validation data for authentication method 2 can be created.
- Since:
- 1.1
- Whiteflag version:
- v1-draft.6
- Whiteflag standard x-reference:
- 5.1.2.2 Method 2: Shared Token Validation, 5.2.3 Key and Token Derivation
-
Field Summary
Modifier and TypeFieldDescriptionfinal WfAuthMethod
The authentication method for which this token is valid -
Constructor Summary
ConstructorDescriptionWfAuthToken
(byte[] secret) Constructs a new Whiteflag authentication tokenWfAuthToken
(String secret) Constructs a new Whiteflag authentication token -
Method Summary
Modifier and TypeMethodDescriptionfinal void
destroy()
Destroys this Whiteflag authentication token by clearing the shared secretfinal byte[]
getVerificationData
(byte[] context) Generates the Whiteflag verification data to prove possession of the tokenfinal String
getVerificationData
(String context) Generates the Whiteflag verification data to prove possession of the tokenfinal boolean
Determine if this Whiteflag cipher has been destroyed.
-
Field Details
-
method
The authentication method for which this token is valid
-
-
Constructor Details
-
WfAuthToken
Constructs a new Whiteflag authentication token- Parameters:
secret
- a hexadecimal string with the shared secret used as an authentication token
-
WfAuthToken
public WfAuthToken(byte[] secret) Constructs a new Whiteflag authentication token- Parameters:
secret
- a byte array with the shared secret used as an authentication token
-
-
Method Details
-
destroy
public final void destroy()Destroys this Whiteflag authentication token by clearing the shared secret- Specified by:
destroy
in interfaceDestroyable
-
isDestroyed
public final boolean isDestroyed()Determine if this Whiteflag cipher has been destroyed.- Specified by:
isDestroyed
in interfaceDestroyable
- Returns:
- TRUE if destroyed, else FALSE
-
getVerificationData
Generates the Whiteflag verification data to prove possession of the token- Parameters:
context
- a hexadecimal string with information to bind the derived key to the intended context- Returns:
- a hexadecimal string with the verification data
- Throws:
IllegalArgumentException
- if the authentication token has been destroyed
-
getVerificationData
public final byte[] getVerificationData(byte[] context) Generates the Whiteflag verification data to prove possession of the token- Parameters:
context
- a byte array with information to bind the derived key to the intended context- Returns:
- a byte array with the verification data
- Throws:
IllegalArgumentException
- if the authentication token has been destroyed
-