Class ServerTokenVerifier

java.lang.Object
io.getlime.security.powerauth.crypto.server.token.ServerTokenVerifier

public class ServerTokenVerifier extends Object
Class to simplify token verification on the server side.
Author:
Petr Dvorak, petr@wultra.com
  • Constructor Details

    • ServerTokenVerifier

      public ServerTokenVerifier()
  • Method Details

    • convertTokenTimestamp

      public byte[] convertTokenTimestamp(long timestamp)
      Helper method to convert provided timestamp into bytes (from string representation), for the purpose of token timestamping.
      Parameters:
      timestamp - Timestamp to be converted.
      Returns:
      Provided timestamp in milliseconds converted as bytes.
    • validateTokenDigest

      public boolean validateTokenDigest(byte[] nonce, byte[] timestamp, String version, byte[] tokenSecret, byte[] tokenDigest) throws GenericCryptoException, CryptoProviderException
      Validate provided token digest for given input data and provided token secret.
      Parameters:
      nonce - Token nonce, 16 random bytes.
      timestamp - Token timestamp, Unix timestamp format encoded as bytes (from string representation).
      version - Protocol version.
      tokenSecret - Token secret, 16 random bytes.
      tokenDigest - Token digest, 32 bytes to be validated.
      Returns:
      Token digest computed using provided data bytes with given token secret.
      Throws:
      GenericCryptoException - In case digest computation fails.
      CryptoProviderException - In case cryptography provider is incorrectly initialized.