A note from 2026: This article was published in 2019. Since then, WebAuthn and passkeys have become broadly supported across major browsers and platforms, while SAP Commerce Accelerator storefronts such as Powertools are now considered legacy compared with SAP Composable Storefront for new implementations.

Rauf Aliev

In this article, I give a technical overview of hardware security key-based authentication and take you through a worked example of SAP Commerce and hardware security key integration.

Introduction

Digital transformation is happening everywhere, and as a result, enterprises are turning inside out. Formerly closed systems now reside in the cloud, often outside the traditional zone of control of security departments. When a company exposes its systems and internal information to agents, partners, and customers, security risks increase.

SAP Commerce Cloud is widely used as a platform for bringing B2C experiences into the B2B world. You need to be able to provide peace of mind to your business partners and customers that their sensitive data won’t be compromised. When it comes to opening up such data to anyone outside the company, security becomes a key concern.

In this article, I give a technical overview of hardware security key-based authentication and take you through a worked example of SAP Commerce and hardware security key integration.

In the experiments and PoC, I used hardware keys from Yubico: YubiKey 5 NFC and YubiKey NFC Security Key, multi-protocol key-sized devices supporting FIDO2/WebAuthn.

Let’s start with a short overview of authentication methods, their advantages, and their drawbacks. What’s wrong with good old passwords?

Passwords Are No Longer Enough

According to the market survey from SecureAuth Corp., 39% of companies use password-only authentication. OneLogin reports that 93% of their respondents said their companies have guidelines around password complexity. Single authentication provided by passwords is no longer sufficient, and there are six reasons for that:

According to the Market Pulse Survey, 75% of respondents said they reuse passwords across different accounts (compared with 56% in 2014), 47% reuse passwords for both personal and work accounts, and users rarely change passwords for work accounts (23% do this at most twice a year) and personal accounts (67%).

Service providers do not always follow recommendations and security standards. The reasons vary. Last March, Facebook confirmed that it had stored millions of user passwords in plain text for years. Although this did not result in a data breach, we see that even giants deviate from best practices, endangering users’ privacy and business reputation. Of course, for millions of smaller services, the situation is even worse: many of them cut corners and rely on security through obscurity to release early.

In other words, a password is a weak link in this chain. OK, if not passwords, then what? Phishing.

According to Gartner, phishing is the most common targeted method of cyberattack. This method of trying to gather personal information using deceptive emails and websites is the fastest-growing sport in the hacker community. Data protection and security implications in corporations are fundamental today, not only to ensure user privacy but also potentially to save a company from damages worth millions.

Adding a second authentication mechanism is becoming a must in all B2B solutions where security risk is high.

Passwordless Authentication Methods

Passwordless methods can be used for primary and/or secondary authentication steps, as well as a single-factor authentication method where only one step is present. Some methods are designed only for second-factor authentication.

The following methods are generally associated with a passwordless login:

Some of the methods above assume that the phone number is uniquely associated with a user. In fact, it is not: in many countries, phone numbers are reassigned to new users when abandoned. Text messages and phone calls can be redirected to another device or service. Also, all listed methods require you to be connected to the communication network and to have the specific communication services enabled. For example, when roaming, many people prefer to turn these off, which makes authentication impossible or expensive.

SMS-based authentication is not safe, especially if your mobile provider doesn’t provide the required level of security. Being locked to cellular services, attackers can use social engineering against phone companies to redirect messages and even manipulation of the Signaling System 7 network.

Hardware security keys are currently the best solution for multi-factor authentication. However, they do not guarantee absolute immunity. In March 2011, RSA Security was hacked, compromising up to 40 million tokens, which RSA agreed to replace. Literally a couple of months ago, Google Titan announced free replacement for the keys because of a “misconfiguration in the pairing protocols” and the risk of being hacked. Companies learn from their mistakes, and the latest products seem to be very secure and stable.

Passwordless methods can be used in combination with each other and with password-based methods. Let’s have a closer look at these options.

Single-Factor and Multi-Factor Authentication

Single-factor authentication (SFA) is a process for securing access to a system that identifies the party requesting access through only one category of credentials.

There are two common single-factor authentication methods:

The third pattern, “single-factor authentication with a hardware security key only,” is not supported by the main browsers yet. At the time of writing (May 2019), this is supported only by Edge on Windows.

Two-factor authentication, also called two-step verification, adds an extra step to the sign-in process: the second factor.

The most common form of two-factor authentication is mixing password-based authentication with a passwordless approach using SMS services. This assumes that the user has a personal device, a mobile phone, nearby each time the system requests a second verification.

There are two common patterns for two-factor authentication:

So, hardware security keys can be easily used for second-factor authentication as one-time password generators or as containers of private keys.

Multi-factor authentication (MFA) requires two or more authentication methods combined to log in.

With this method, the authentication credentials are combined from:

The last two components involve hardware devices. Let’s have a look at hardware security keys in detail.

Hardware Security Keys (Tokens)

For many years, one-time password hardware tokens, along with X.509 browser certificates, seemed unbreakable. Some keys, such as Sentinel’s, require installing OS-specific drivers. The need to install drivers and/or use Java applets resulted in a popular backlash.

There are three groups of protocols generally associated with hardware security keys:

In this article, I focus mainly on the last two types of protocols. Both have FIDO in the name. What is that?

FIDO Alliance Standards

FIDO is an organization, founded in 2012, that tasked itself with a mission to make authentication simpler for consumers and easier for service providers to deploy and manage, as well as address “the problems users face with creating and remembering multiple usernames and passwords.”

The alliance has published three sets of specifications for simpler, stronger authentication:

Universal Authentication Framework, or UAF

UAF is a standard for passwordless authentication. It involves the use of a client-side authenticator that may sample biometric data such as a face image, fingerprint, or voice print to unlock the private key used for signing the authentication response.

FIDO UAF registration and authentication architecture

(taken from https://fidoalliance.org/specs/fido-uaf-v1.1-id-20170202/fido-uaf-overview-v1.1-id-20170202.html)

Biometric or PIN authentication in UAF happens locally on the device.

Local biometric or PIN authentication in UAF

There are three key problems with biometric identification:

Universal Second Factor, or U2F

Universal Second Factor (U2F) is meant to replace non-secure SMS-based second-factor authentication with secure U2F token-based authentication. This standard was developed by Google and Yubico. Currently, U2F seems to be the lightest, safest, and most phishing-resistant multi-factor authentication known today.

A U2F token such as the YubiKey performs an authentication handshake with a relying party, such as a website. It not only proves to a website that it’s your unique key, but also requires that the website prove its identity too, preventing lookalike sites from stealing credentials.

With this approach, the user logs in with a username and password as before. The app can also prompt the user to present a second-factor device immediately after, or before, a sensitive operation is requested. The strong second factor allows the service to simplify its passwords (e.g., a 4-digit PIN) without compromising security.

U2F authentication flow

U2F is comprised of two basic components:

These components communicate with each other using a protocol called CTAP1 (Client to Authenticator Protocol). CTAP1 tokens cannot be used without the user entering a username. Its newer version, CTAP2, is capable of storing the username (see the next section), but this mode is not supported by the majority of browsers yet.

WebAuthn and CTAP architecture

The U2F spec contains three functions:

What is important is that users can self-provision their own security keys. There is no need to get them registered upfront by admins, as it was with first-generation keys.

Registration flow:

Authentication flow:

There is also a software “keyless” implementation of the authenticator, Soft U2F.

The following browsers currently support the use of U2F security keys:

FIDO2 and WebAuthn

FIDO2 is an evolution of the U2F standard and is backward compatible with it. It has two parts:

WebAuthn has two flows:

  1. U2F flow, also known as Client to Authenticator Protocol v1 (CTAP1), and
  2. Passwordless flow, CTAP2.

The authenticator generates and securely stores credentials. Private keys, PINs, and biometric information never leave the authenticator. It is a write-only device and onboard app with standard interfaces.

FIDO2 and WebAuthn components

One of the major enhancements of CTAP2/WebAuthn devices is that they are able to store private keys in persistent memory along with the username and domain. That makes it possible to provide an identity (username) and authenticate it in the same flow.

When a website prompts a user to get authenticated, and the user taps on the connected key, the website (browser → JavaScript → server) receives a signal that the user can be authenticated, as well as the username and domain.

Because the standard is too young, Chrome and Firefox don’t yet support passwordless authentication. If you want to try it, use Windows 10 v.1809+ with Microsoft Edge. Yubico says that the latest macOS with Safari Technology Preview is also capable. On my machine, Safari T.P. Release 82 with Web Authentication activated couldn’t detect YubiKey 5 NFC.

By 2022, Gartner predicts that 60% of large and global enterprises and 90% of midsize enterprises will implement passwordless methods.

All major browsers are on track to implement the Web Authentication API. As of May 2019, Edge, Firefox, Chrome, Opera, and Android browsers support WebAuthn. Apple is working on integrating it into its products. The latest Safari Technology Preview already includes some support.

It may sound confusing, but “supporting WebAuthn” doesn’t mean “supporting WebAuthn in full.” For example, Google Chrome and Firefox have implemented only the U2F flow of the spec, and Firefox’s feature needs to be manually activated. The CTAP2 (passwordless) flow is not yet available in all browsers except Microsoft Edge at the time of writing. Because the standard has already been approved by W3C, this will definitely happen one day, and major services have already added support to their products to get 100% ready. Both WebAuthn and the FIDO2/FIDO U2F authentication protocols are already supported by Dropbox, Facebook, GitHub, Salesforce, Stripe, and Twitter, with other popular websites expected to integrate support for these standards in the coming months.

Registration Using WebAuthn

  1. The website generates a challenge – a random code. It prevents replay attacks.
  2. The website creates an instance of PublicKeyCredentialCreationOptions.
  3. The browser executes a create command of the Web Authentication API (JavaScript: navigator.credentials.create).
  4. The browser validates rp against the origin. It prevents phishing.
  5. The authenticator checks user presence and consent. It prevents silent tracking. For example, the user is asked to touch the USB fob.
  6. The authenticator creates a pair of keys: private and public. The secret key is not shared with the browser. It is inside the authenticator. The browser will receive the public key.
  7. The website verifies the attestation signature created by the authenticator, namely:
    • Origin against the top-level domain from the package
    • Challenge against the original challenge
    • The validity of the public key signature
  8. The attestation is added to the user account.

WebAuthn registration sequence diagram

The details are well explained here: https://developers.yubico.com/FIDO2/FIDO2_WebAuthn_Developer_Guide/WebAuthn_Client_Registration.html

Integration with SAP Commerce Cloud

Find below screenshots from the proof-of-concept project of YubiKey integration with the SAP Commerce Cloud out-of-the-box Powertools Accelerator. It demonstrates how registration works:

Step 1. The customer uses the out-of-the-box password-based authentication.

SAP Commerce login form

Step 2. The customer can, may, should, or must — depending on the business security requirements — add a secondary authentication method:

SAP Commerce account page with security key options

Step 3. The customer adds their security key to the account. The customer clicks on the “ADD SECURITY KEY” button:

Add a security key button in SAP Commerce account settings

“Next”: the browser asks for proof of user presence:

Browser prompt asking the user to interact with the security key

Touch the Yubico fob inserted in the USB port:

Touching a YubiKey inserted into a USB port

And user consent:

Browser prompt for user consent during security key registration

The key has already been registered. The system asks for a name for the key. By default, the name is built from the first name of the user (from the profile) and a key number.

Security key name input

“Next,” and we see our key added to the system. You can add more than one key.

Registered security key in SAP Commerce account settings

Authentication Sequence: The Second-Factor Mode

In the second-factor mode, the username is known in this process: the user entered it before the process starts.

  1. The website generates a challenge – a random code. It prevents replay attacks.
  2. The website sends the challenge, top-level domain (rp), and username (user) to the browser using the Web Authentication API (JavaScript: navigator.credentials.XXXXXXXXXX).
  3. The browser validates rp against the origin. It prevents phishing.
  4. The authenticator checks user presence and consent. It prevents silent tracking and covert login.
  5. The authenticator retrieves the private key for the user from storage.
  6. The authenticator checks and signs the client data (hashed challenge + domain) with the private key and sends the signed package back to the browser.
  7. The browser sends this information to the website.
  8. The website validates the response:
    • The website checks the challenge against the original challenge.
    • The website checks the origin against the top-level domain from the package.
    • The website checks the validity of the private key signature. It prevents man-in-the-middle attacks and phishing.
    • The website checks the data against the public key that was stored in the database (see registration).

WebAuthn second-factor authentication sequence diagram

Integration with SAP Commerce Cloud

The simplest implementation activates the second authentication method once the first has been passed:

SAP Commerce login form for two-factor authentication

Click “Log in.” If the user has only one second-factor method configured and password authentication is the first-factor method, there is no need to show a “use alternative methods” link. However, if you have more than one second-factor method configured (for example, a U2F/FIDO2 hardware key, one-time password, or text message), you need to implement a simple pop-up window with a list of methods and allow the choice of one option from the list. For the single second-factor method configured, we can request the browser OOTB window. This is what it looks like in Google Chrome:

Google Chrome security key prompt

In Firefox:

Firefox security key prompt

Insert the key you used at registration, and touch the key.

Touching a YubiKey inserted into a USB port

If the user attempts to use a fob not assigned to the account, the system shows the following message:

SAP Commerce error message for an unassigned security key

The system knows what public key is expected from the user, and this check is performed by the browser, not JavaScript.

Authentication Sequence: The First-Factor Mode

In the first-factor mode, the username is not known. The username is sent along with the signature from the device, so the user doesn’t have to enter a username. The website just finds a user with the user handle received from the authenticator, retrieves a public key associated with the user, and checks the validity of received data against the public key.

You might say that it is insecure: if the fob is lost, someone else can access the system. That is why “first-factor mode” is not the same as “single-factor mode.” The customer can (or even is required to) select two or more authentication factors: one is from the “what I have” group, such as Yubico key authentication, and another is from the “what I know” or “what I am” group, which can be a PIN code, password, or biometrics. For the password case, the password form is available only if the YubiKey is valid. Unlike in the second-factor authentication mode, the attacker can’t brute-force the password or PIN code because the login form is not available. It makes the password/PIN code requirements much simpler: even a four-digit PIN will work well if the number of failed attempts is limited to a few.

WebAuthn first-factor authentication sequence diagram

SAP Commerce Integration

  1. Multi-factor authentication configuration page
  1. Enhanced login page (with 2FA)

SAP Commerce Cloud integration diagram for multi-factor authentication

Yubico OTP (One-Time Password)

OTP is one of six applications available on YubiKey 5 NFC. Think of this as an app inside the key, or the key’s extra capability. OTP stands for One-Time Password. With this feature, your key is basically another external keyboard with a single button. Touching this button generates a 44-character keystroke that can be processed by any app capable of working with user input.

OTP is a simple yet strong authentication mechanism that can be used as the second factor in a two-factor authentication scheme or on its own, providing single-factor authentication.

The most common pattern is using OTP in combination with username and password:

SAP Commerce login with Yubico OTP field

Because of the ability of YubiKey OTP to emulate a USB keyboard, it works from any computer for any number of applications with only user-level rights and no client software needed. When you touch the key, it generates a series of keystrokes from a virtual keyboard. There are no special drivers that need to be installed to use the fob. Any browser will support OTP if the app in the browser is designed to support OTP authentication.

The architecture diagram of SAP Commerce Cloud / YubiCloud integration for OTP mode:

SAP Commerce Cloud and YubiCloud integration architecture for OTP mode

All one-time password generators are vulnerable to phishing and social engineering attacks. The problem is that the generated password can be stolen by the attacker because it is exported to the form in plain form.

The following diagram shows how OTP generation and check are implemented in the YubiKey services:

YubiKey OTP generation and validation flow

Thanks

The author would like to thank Igor Sokolov for constructive criticism of the article, advice, and recommendations.

Useful Links