Poco::OSP::Auth::TwoFactor

template < typename Engine >

class HOTPGenerator

Library: OSP/Auth/TwoFactor
Package: TwoFactor
Header: Poco/OSP/Auth/TwoFactor/HOTPGenerator.h

Description

This class generates HOTPs (HMAC-based One Time Passwords) according to RFC 4226.

The hash function for the HMAC is configurable via a template parameter and is typically Poco::SHA1Engine.

Member Summary

Member Functions: digitsPower, generate

Constructors

HOTPGenerator inline

explicit HOTPGenerator(
    const std::string & secret,
    std::size_t codeDigits = 6
);

Creates the HOTPGenerator with the given secret (binary string) and number of code digits, which should be from 6-8.

Member Functions

generate inline

std::string generate(
    Poco::UInt64 movingFactor
);

Returns a HOTP string based on the secret and the given movingFactor.

digitsPower protected inline

Poco::UInt32 digitsPower() const;

Securely control IoT edge devices from anywhere   Connect a Device