TrustCore SDK NanoCrypto API reference  version 7.0
otp.h File Reference

Header file for declaring One-Time-Password and S/Key methods. More...

Go to the source code of this file.

Functions

MOC_EXTERN MSTATUS OTP_otp (MOC_HASH(hwAccelDescr hwAccelCtx) ubyte ht_type, const sbyte *seed, const sbyte *pwd, ubyte4 seq, ubyte res[8])
 Computes a one-time password. More...
 
MOC_EXTERN MSTATUS OTP_otpEx (MOC_HASH(hwAccelDescr hwAccelCtx) const sbyte *challenge, const sbyte *pwd, sbyte res[20])
 Computes a one-time password from a challange string. More...
 

Detailed Description

Header file for declaring One-Time-Password and S/Key methods.

To enable the methods in this file please define:

  • __ENABLE_MOCANA_OTP__

otp.h

Function Documentation

◆ OTP_otp()

MOC_EXTERN MSTATUS OTP_otp ( MOC_HASH(hwAccelDescr hwAccelCtx) ubyte  ht_type,
const sbyte *  seed,
const sbyte *  pwd,
ubyte4  seq,
ubyte  res[8] 
)

Computes a one-time password from a hash type, seed, initial password, and sequence number.

Parameters
ht_typeHash type identifier from ca_mgmt.h. This is one of
  • ht_md4
  • ht_md5
  • ht_sha1
seedThe initial seed as a character string. This is case insensitive and may be the empty string.
pwdThe initial password as a character string. This is NOT case insensitive and there is no limit on the length of this string.
seqThe sequence number. This is the number of hashing iterations that will be performed.
resBuffer to hold the resulting one time password as a byte array. This is 64 bits (8 bytes) in length.

To enable this method please define:

  • __ENABLE_MOCANA_OTP__
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.

◆ OTP_otpEx()

MOC_EXTERN MSTATUS OTP_otpEx ( MOC_HASH(hwAccelDescr hwAccelCtx) const sbyte *  challenge,
const sbyte *  pwd,
sbyte  res[20] 
)

Computes a one-time password from a challange string. This string as described in RFC 2289 consists of "otp-<hash identifier> <sequence integer> <seed>" where the spaces shown must be present and hash identifier is "md4", "md5", or "sha1".

Parameters
challengeA challange string in the form described above.
pwdThe initial password as a character string. This is NOT case insensitive and there is no limit on the length of this string.
resBuffer to hold the resulting one time password as a string. This will be 19 characters plus the '\0' terminating character.

To enable this method please define:

  • __ENABLE_MOCANA_OTP__
Returns
OK (0) if successful, otherwise a negative number error code from merrors.h.