Class WfAuthToken

java.lang.Object
org.whiteflagprotocol.java.crypto.WfAuthToken
All Implemented Interfaces:
Destroyable

public final class WfAuthToken extends Object implements 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

    Fields
    Modifier and Type
    Field
    Description
    The authentication method for which this token is valid
  • Constructor Summary

    Constructors
    Constructor
    Description
    WfAuthToken(byte[] secret)
    Constructs a new Whiteflag authentication token
    Constructs a new Whiteflag authentication token
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Destroys this Whiteflag authentication token by clearing the shared secret
    final byte[]
    getVerificationData(byte[] context)
    Generates the Whiteflag verification data to prove possession of the token
    final String
    Generates the Whiteflag verification data to prove possession of the token
    final boolean
    Determine if this Whiteflag cipher has been destroyed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • method

      public final WfAuthMethod method
      The authentication method for which this token is valid
  • Constructor Details

    • WfAuthToken

      public WfAuthToken(String secret)
      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 interface Destroyable
    • isDestroyed

      public final boolean isDestroyed()
      Determine if this Whiteflag cipher has been destroyed.
      Specified by:
      isDestroyed in interface Destroyable
      Returns:
      TRUE if destroyed, else FALSE
    • getVerificationData

      public final String getVerificationData(String context)
      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