Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

GenerateTOTP Function

Overview

The GenerateTOTP function generates a Time-Based One-Time Password based on the RFC 6238.

Syntax/Parameters

Syntax

int = GenerateTOTP ( string key | byte key[], [string algorithm],
                [string date], [byte digits], [dword timestep] );

Parameters

key

A string or byte array representing the shared secret used to generate the password. If a string is passed the contents are assumed to be Base32 encoded.

algorithm

An optional string specifying the cryptographic algorithm to use for creating the TOTP value. The accepted modes for RFC 6238 are: “SHA1”, “SHA256” and “SHA512”. Other acceptable values are based on the list provided by Cryptography API: Next Generation documentation. The default value is “SHA1”.

date

An optional string specifying the date and time to use when generating the password. The default is the current date and time.

digits

An optional byte value specifying the number of digits in the resulting password. The default is 6.

timestep

An optional dword specifying the life of the password in seconds. The default is 30 seconds.

Return Value

Returns an int as the one-time password or a formatted error code. The return value may have less digits than the digits parameter if the resulting password had leading 0s.

Remarks

A Time-based One-Time Password (TOTP) is created by an algorithm that generates a one-time password (OTP) that uses the current time as a source of uniqueness. As an extension of the HMAC-based one-time password algorithm (HOTP), it has been adopted as Internet Engineering Task Force (IETF) standard RFC 6238.

The key is generally provided by the site of system where the TOTP will be used. The other parameters, except date, are set by that same system and need to match. 

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic