Example Code

Generate 2FA authentication(Offline)

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Overview

This example demonstrates how to generate an QR and pin code used in Offline 2FA authentication based on a secret key.

 

 

Description

2FA authentication is used as an extra layer of protection for user login, it uses TOTP(Time based password) or HOTP(counter based password) for pincode generation. 

This program generates a QRcode that is used to register a standard 2FA app(e.g. Google authenticator).

The generated pin code matches the code in the App, Therefore this can be used to authenticate a user.

 

In the attachment are 2 projects, one using .NET for generating the QR and pin code, the other uses only native Labview code(using library's mentioned in the requirements section).

 

 

Requirements

LabVIEW 2016 (or compatible)

 

For the native Labview project the following library's are needed:

- Crypto tools : https://forums.ni.com/t5/Example-Programs/Cryptography/ta-p/3494085?profile.language=en

- QR generator: https://forums.ni.com/t5/Example-Programs/Offline-QR-Code-Generator-v1-1/ta-p/3496535?profile.langua...

 

Steps to Implement or Execute Code

Steps to implement or execute the code are described in the Main VI

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.