Repository navigation
WhatIsDPoP
Caution
Alpha Feature — GAM DPoP support is currently in alpha and requires a special pre-release build. It is not ready for production use. APIs, configuration options, and behavior may change without notice.
Do not enable DPoP on production GAM installations. Use a separate test environment with non-critical credentials.
The latest alpha DPoP build (Alpha 10) is at:
DPoP (Demonstrating Proof-of-Possession, RFC 9449) is an OAuth 2.0 extension that binds OAuth tokens to a specific cryptographic key. Every time GAM uses a refresh token, it must also present a signed proof that it possesses the private key the token was bound to.
GAM's OAuth tokens are bearer tokens — anyone who has a copy can use them. A stolen oauth2.txt file gives an attacker full Google Workspace admin access until the token is revoked. Possible attack vectors include:
- Malware exfiltrating files from the GAM config directory
- Backup systems storing unencrypted copies of
oauth2.txt - Insider access to the machine's filesystem
- Accidental exposure in logs, screenshots, or support tickets
With DPoP enabled, GAM binds the refresh token to a private key on your machine during the initial OAuth authorization flow. From that point on:
- Every token refresh request (roughly hourly, or on the next GAM command after expiry) must include a DPoP proof — a signed JWT proving possession of the private key.
- Google's authorization server verifies the proof's signature against the public key the token was bound to.
- A stolen
oauth2.txtfile cannot be refreshed without the corresponding private key.
If the private key is stored in hardware (TPM, Secure Enclave, YubiKey, or HSM), it cannot be extracted — even with root/admin access to the machine. The refresh token becomes bound to a physical device and only that device can use the oauth2.txt refresh token.
Without DPoP: stolen oauth2.txt = full admin access
With DPoP: stolen oauth2.txt = worthless
(attacker also needs the private key)
With hardware DPoP: stolen oauth2.txt = worthless
(attacker must also physically steal hardware)
Google's implementation of DPoP protects the refresh token — the long-lived credential stored in oauth2.txt that GAM uses to obtain short-lived access tokens. The DPoP proof is required whenever GAM exchanges the refresh token for a new access token (usually once per hour).
Google Access tokens themselves are not DPoP-bound. Once GAM obtains an access token, it uses it as a normal bearer token for Google API calls. However, access tokens are short-lived (60 minutes or less), limiting the exposure window compared to a refresh token valid for months or years.
Setting up DPoP for GAM follows three stages:
-
Stage 1: Provision a Hardware Key & Configure GAM — Choose the backend for your platform, safely provision a non-exportable signing key on real hardware, and save GAM's
dpopsettings. -
Stage 2: Confirm Local Signing with
gam check dpop— Verify signer initialization, hardware key storage, and local DPoP proof signing before touching OAuth credentials. -
Stage 3: Recreate OAuth and Confirm with
gam oauth info— Revoke any existing bearer token, create new DPoP-bound credentials (gam oauth create), and confirm Google enforces key binding (gam oauth info).
Choose a backend based on your operating system and security requirements:
| Backend | Platform | Key Storage | Hardware-Backed | Best For |
|---|---|---|---|---|
macos_secureenclave |
macOS (Apple Silicon) | Secure Enclave | Yes | Mac admins with Apple Silicon |
windows_certstore |
Windows | Windows Cert Store (TPM via CNG) | Yes (with TPM) | Windows admins with TPM |
linux_tpm |
Linux | TPM 2.0 | Yes | Linux servers with TPM |
yubikey |
Any | YubiKey PIV | Yes | Cross-platform, portable key |
fido2_previewsign |
Any | YubiKey 5.8+ / CTAP 2.3 (previewSign) |
Yes | Certificate-free FIDO2 hardware key (experimental) |
pkcs11 |
Any | PKCS#11 token (HSM, smart card) | Yes (with HSM/smart card) | Hardware security modules (HSMs), smart cards |
software |
Any | PEM file on disk | No (WARN in GAM) |
Testing or low-security environments |
Important
Hardware-backed keys provide the strongest protection because private key
material never leaves the chip and cannot be exported. Both gam check dpop
and gam oauth info inspect your keystore and display an orange WARN if a
software-backed key is detected.
The Apple Secure Enclave is a dedicated security coprocessor in Apple Silicon Macs (M1 and later). Keys generated in the Secure Enclave cannot be exported or read — signing operations happen inside the chip.
Requirements & Real-World Hardware Notes:
-
macOS 15 (Sequoia) or later on Apple Silicon (M1 or newer). Intel Macs (even with T2) and macOS virtual machines without Secure Enclave passthrough cannot create CryptoTokenKit Secure Enclave identities with
sc_auth— use a YubiKey or PKCS#11 token instead. -
Per-user isolation: Secure Enclave CryptoTokenKit identities live in the creating user's Data Protection Keychain (see Protecting Keys with the Secure Enclave). Create the key while logged in as the same macOS user that will run GAM — other users,
sudounder another user, androotLaunchDaemons cannot access your key. -
Headless / SSH /
launchdvs. Touch ID (-t bio): Standard keys (without-t bio) work over SSH and in per-userLaunchAgentjobs. Keys created with-t bioprompt for Touch ID on token refresh (roughly hourly) and duringgam check dpop/gam oauth info, which blocks SSH and background automation. -
Duplicate labels: Check
sc_auth list-ctk-identitiesbefore creating a key. Runningsc_auth create-ctk-identity -l gam-dpopmultiple times creates multiple entries; remove stale ones (sc_auth delete-ctk-identity -h <PublicKeyHash>) so GAM resolves cleanly.
# Check what CryptoTokenKit identities already exist
sc_auth list-ctk-identities
# Create a P-256 non-exportable Secure Enclave key (SSH/automation friendly)
sc_auth create-ctk-identity -l gam-dpop -k p-256-ne
# Or require Touch ID confirmation when signing DPoP proofs (interactive desktop only)
# sc_auth create-ctk-identity -l gam-dpop -k p-256-ne -t bio
# Verify the new identity appears
sc_auth list-ctk-identitiesNote
sc_auth create-ctk-identity also generates a 1-year self-signed certificate.
DPoP uses the underlying private key rather than the certificate, so the key
continues working after certificate expiry.
gam config dpop true dpop_backend macos_secureenclave dpop_backend_config "gam-dpop" saveProceed to Stage 2: Confirm Local Signing with gam check dpop.
On Windows, GAM uses the windows_certstore backend (CNG / CryptoAPI) to sign with a certificate's private key in the Windows certificate store. Storing the key under "Microsoft Platform Crypto Provider" places the private key inside your hardware TPM 2.0 chip where it cannot be extracted.
Requirements & Real-World Hardware Notes:
-
Windows 10/11 or Windows Server 2019+ with TPM 2.0 enabled in BIOS/UEFI. Before provisioning, verify Windows sees a ready TPM and the Platform Crypto Provider:
If
Get-Tpm | Format-List TpmPresent, TpmReady certutil -csplist | Select-String "Platform Crypto"
TpmPresentorTpmReadyisFalse, enable/initialize TPM 2.0 (Intel PTT or AMD fTPM) in UEFI firmware settings first. -
CurrentUservs.LocalMachine(SSH & Scheduled Tasks):-
Cert:\CurrentUser\My(default) works for interactive desktop/PowerShell sessions. However, over public-key OpenSSH sessions or Scheduled Tasks without a stored password (Network Logon Type 3), Windows does not unlock user DPAPI credentials andgamfails with0x80090016(NTE_BAD_KEYSET). -
Cert:\LocalMachine\My(,local_machine) is required for SSH, Scheduled Tasks, and background services. Note that machine-store keys are accessible to local Administrators (or any non-Admin account granted Read access via Certificate Manager → All Tasks → Manage Private Keys); restrict NTFS permissions on your GAM config directory andoauth2.txtso unauthorized local users cannot readoauth2.txt.
-
-
Avoid duplicate subjects or orphaned keysets:
dpop_backend_configwith a subject name matches by substring. If old or broken certificates with the same subject remain in the store, GAM may pick an old cert (or hitMissing stored keyset/0x80090016). Either delete stale certificates or reference the new certificate by exactthumbprint:<HEX>.
Option A — PowerShell New-SelfSignedCertificate:
For Current User (Cert:\CurrentUser\My):
New-SelfSignedCertificate `
-Subject "CN=GAM DPoP Signing Key" `
-KeyAlgorithm ECDSA_nistP256 `
-CertStoreLocation Cert:\CurrentUser\My `
-KeyExportPolicy NonExportable `
-Provider "Microsoft Platform Crypto Provider" `
-NotAfter (Get-Date).AddYears(30)Or for Local Machine (Cert:\LocalMachine\My, run PowerShell as Administrator):
New-SelfSignedCertificate `
-Subject "CN=GAM DPoP Signing Key" `
-KeyAlgorithm ECDSA_nistP256 `
-CertStoreLocation Cert:\LocalMachine\My `
-KeyExportPolicy NonExportable `
-Provider "Microsoft Platform Crypto Provider" `
-NotAfter (Get-Date).AddYears(30)Option B — Fallback when New-SelfSignedCertificate fails with 0x80090017 (NTE_PROV_TYPE_NOT_DEF):
Some TPM 2.0 / AMD fTPM / Pluton drivers reject PowerShell's CertEnroll ECC call with 0x80090017 NTE_PROV_TYPE_NOT_DEF. Provision the TPM-backed P-256 key using certreq -new with ProviderType = 0 instead (use MachineKeySet = FALSE for CurrentUser, or MachineKeySet = TRUE in an elevated PowerShell for LocalMachine):
@"
[Version]
Signature="`$Windows NT`$"
[NewRequest]
Subject = "CN=GAM DPoP Signing Key"
KeyAlgorithm = ECDSA_P256
KeyLength = 256
HashAlgorithm = sha256
ProviderName = "Microsoft Platform Crypto Provider"
ProviderType = 0
Exportable = FALSE
MachineKeySet = FALSE
RequestType = Cert
ValidityPeriod = Years
ValidityPeriodUnits = 30
"@ | Out-File -Encoding ascii "$env:TEMP\dpop-ec.inf"
certreq -new "$env:TEMP\dpop-ec.inf" "$env:TEMP\dpop-ec.cer"
Remove-Item "$env:TEMP\dpop-ec.inf", "$env:TEMP\dpop-ec.cer"Verify the certificate AND healthy TPM key provider:
# Inspect certs in CurrentUser\My (or swap for Cert:\LocalMachine\My)
Get-ChildItem Cert:\CurrentUser\My |
Where-Object Subject -like "*GAM DPoP Signing Key*" |
Format-List Subject, Thumbprint, NotAfter, HasPrivateKey
# Confirm the key uses "Microsoft Platform Crypto Provider" without "Missing stored keyset"
certutil -user -store My "<THUMBPRINT>"
# (For LocalMachine, omit -user: certutil -store My "<THUMBPRINT>")Warning
Avoid "Microsoft Software Key Storage Provider" in production: If a cert
uses the Software KSP instead of "Microsoft Platform Crypto Provider", the
private key is stored in software rather than hardware. gam check dpop and
gam oauth info inspect CNG provider Impl Type and will flag software keys
with WARN.
For Current User (Cert:\CurrentUser\My):
# Recommended: bind by exact thumbprint so extra certs never cause ambiguity
gam config dpop true dpop_backend windows_certstore dpop_backend_config "thumbprint:<THUMBPRINT>" save
# Or by unique subject substring:
# gam config dpop true dpop_backend windows_certstore dpop_backend_config "GAM DPoP Signing Key" saveFor Local Machine (Cert:\LocalMachine\My, for SSH / Scheduled Tasks), append ,local_machine:
gam config dpop true dpop_backend windows_certstore dpop_backend_config "thumbprint:<THUMBPRINT>,local_machine" save
# Or: gam config dpop true dpop_backend windows_certstore dpop_backend_config "GAM DPoP Signing Key,local_machine" save(If a non-Administrator user runs GAM against a LocalMachine key, open certlm.msc → Personal → Certificates → right-click the cert → All Tasks → Manage Private Keys and grant that user Read permission.)
Proceed to Stage 2: Confirm Local Signing with gam check dpop.
On Linux, GAM uses tpm2-pytss to sign directly with a persistent key inside the TPM 2.0 chip. No X.509 certificates or PKCS#11 middleware are required.
Requirements & Real-World Hardware Notes:
-
TPM 2.0 resource manager device (
/dev/tpmrm0): Verify withls -l /dev/tpmrm0. If absent, enable TPM 2.0 / Intel PTT / AMD fTPM in BIOS/UEFI. TPM 1.2 hardware (/dev/tpm0only, no/dev/tpmrm0) is not supported — use a YubiKey or PKCS#11 token instead. -
tssgroup access & services: Add your GAM user totss(sudo usermod -aG tss $USER) and log out/in (verify withid). Works over SSH and incron. Forsystemdservices, configureSupplementaryGroups=tssand do not enablePrivateDevices=yes. -
Shared TPM handles & file permissions: Any local user in
tss(orroot) can use persistent handles in/dev/tpmrm0, though they still need read access tooauth2.txt. Restrict~/.gam(chmod 700 ~/.gam && chmod 600 ~/.gam/oauth2.txt ~/.gam/gam.cfg). -
Pre-existing TPM keys on real hardware (important): Production laptops/servers often already have persistent keys at
0x81000001,0x81000002, etc. (created by UEFI, Windows dual-boot/BitLocker, LUKS/systemd-cryptenroll, orclevis). The commands below inspecttpm2_getcap handles-persistentand pick the first unused handle automatically so you never collide with existing system keys. -
Common real-world TPM provisioning errors:
-
0x14c(NV Index or persistent object already defined): The handle you picked is already taken — use thetpm2_getcap handles-persistentlookup below to pick a free handle, or inspect existing handles withtpm2_readpublic -c <handle>(never evictrestricted|decryptStorage Root Keys used for disk encryption). -
TPM_RC_NV_SPACE/TPM_RC_OBJECT_MEMORY: The TPM's persistent NVRAM slots are full (typically 3–7 slots on hardware TPMs). Inspect withtpm2_getcap handles-persistentandtpm2_readpublic -c <handle>to see if stale test keys (0x810000xx) can be freed (tpm2_evictcontrol -C o -c <stale_handle>). - Owner authorization failure (
TPM_RC_BAD_AUTH) on dual-boot machines: Windows or another OS set an owner hierarchy password. You can supply-P <owner_auth>if known, or only runtpm2_clearif you are sure no BitLocker/LUKS keys reside in the TPM (tpm2_clearpermanently destroys all TPM-sealed keys). - Dictionary-attack lockout (
TPM_RC_LOCKOUT): Wait for the lockout cooldown or reset if authorized (tpm2_dictionarylockout -c). -
VMs (Proxmox / VMware / KVM): Attach a vTPM device if needed; note that hypervisor admins can still access host-side vTPM state, and
swtpmemulators are flagged asWARN(software TPM) by GAM.
-
Debian/Ubuntu:
sudo apt install tpm2-tools libtss2-devFedora/RHEL:
sudo dnf install tpm2-tss-devel tpm2-toolsGrant /dev/tpmrm0 access if not already in tss (re-login afterwards so id shows tss):
ls -l /dev/tpmrm0
sudo usermod -aG tss "$USER"Create an ECDSA P-256 signing key and persist it at the first unused handle found by tpm2_getcap handles-persistent:
# Find the first unused persistent handle (0x81000001..0x810000ff)
USED_HANDLES=$(tpm2_getcap handles-persistent)
TPM_HANDLE=""
for i in $(seq 1 255); do
H=$(printf "0x810000%02x" "$i")
if ! printf '%s\n' "$USED_HANDLES" | grep -Fqiw "$H"; then
TPM_HANDLE="$H"
break
fi
done
echo "Using free handle: $TPM_HANDLE"
# Create a primary ECC key under the owner hierarchy
tpm2_createprimary -C o -g sha256 -G ecc256 -c primary.ctx
# Create an ECDSA P-256 signing child key with explicit scheme
# (Add -p "<key_password>" if you want per-key auth, then configure "$TPM_HANDLE,,prompt" or "$TPM_HANDLE,,<key_password>")
tpm2_create -C primary.ctx -g sha256 -G ecc:ecdsa-sha256 \
-u key.pub -r key.priv \
-a "fixedtpm|fixedparent|sensitivedataorigin|userwithauth|sign"
# Load and persist at $TPM_HANDLE
tpm2_load -C primary.ctx -u key.pub -r key.priv -c key.ctx
tpm2_evictcontrol -C o -c key.ctx "$TPM_HANDLE"
# Clean up temporary blobs
rm -f primary.ctx key.ctx key.pub key.priv
# Verify the key
tpm2_readpublic -c "$TPM_HANDLE"Confirm tpm2_readpublic shows type: ecc, curve-id: NIST p256, scheme: ecdsa, and sign in attributes. If you open a new shell later, run tpm2_getcap handles-persistent and inspect candidates with tpm2_readpublic -c <handle>.
# Uses TPM_HANDLE from the commands above (or substitute the hex handle, e.g. 0x81000003)
gam config dpop true dpop_backend linux_tpm dpop_backend_config "$TPM_HANDLE" saveProceed to Stage 2: Confirm Local Signing with gam check dpop.
YubiKey PIV stores a non-exportable private key in the YubiKey's secure element. It works identically across Linux, macOS, and Windows and lets the bound key move physically between authorized workstations.
Requirements & Real-World Hardware Notes:
-
YubiKey 5 series (or PIV-capable YubiKey) and
ykman. -
Check slot occupancy first (
ykman piv info): Generating a key into slot9cpermanently overwrites any key/cert already in9c. If9cis already used (for SSH/GPG/code signing), pick a free PIV slot (9a,9d,9e) and specify it indpop_backend_config. -
Touch & PIN policy for automation: Slot
9cworks well for automation, provided touch is not enforced (--touch-policy=never, the default when omitted). If you set--touch-policy=alwaysor--touch-policy=cached, unattended cron/SSH jobs will time out waiting for a physical touch. Never test wrong PINs repeatedly — 3 failed attempts lock the PIV PIN (requiring PUK reset); change the default123456PIN. Usepromptas the PIN value (,,prompt) to have GAM prompt once per command when needed instead of storing the PIN ingam.cfg(chmod 600 ~/.gam/gam.cfg), or setGAM_DPOP_PINin the environment for scripted runs. -
Linux
pcscd& GPGscdaemonconflicts: On Linux, ensurepcscdis running (sudo apt install pcscd && sudo systemctl enable --now pcscd). On Linux/macOS, ifgpg-agent/scdaemonholds an exclusive lock on the smart card reader, GAM cannot open the YubiKey — either adddisable-ccidto~/.gnupg/scdaemon.conf(and restartgpgconf --kill scdaemon) or ensure other smartcard daemons aren't locking CCID. -
Multiple YubiKeys: Run
ykman list --serialsand include the YubiKey serial number indpop_backend_configso GAM targets the exact device.
# List connected YubiKeys (note serial if using multiple keys) and check existing PIV slots
ykman list --serials
ykman piv info
# Change the default PIV PIN (123456) if not already changed
# ykman piv access change-pin
# Generate a P-256 key in slot 9c (use another free slot if 9c is already occupied)
ykman piv keys generate -a ECCP256 9c pubkey.pem
# Attach a 30-year self-signed certificate
ykman piv certificates generate -s "CN=GAM DPoP Signing" -d 10950 9c pubkey.pem
rm -f pubkey.pem
# Verify certificate and key appear in slot 9c
ykman piv infoThe dpop_backend_config format is serial,slot,pin (blank serial = first YubiKey; blank slot = 9c):
# Prompt interactively once per command when a token refresh needs the PIV PIN (recommended for interactive use):
gam config dpop true dpop_backend yubikey dpop_backend_config ",,prompt" save
# Or store a static PIN (default serial and slot 9c):
# gam config dpop true dpop_backend yubikey dpop_backend_config ",,<PIN>" save
# Or pinned to a specific YubiKey serial and slot:
# gam config dpop true dpop_backend yubikey dpop_backend_config "<SERIAL>,9c,prompt" saveProceed to Stage 2: Confirm Local Signing with gam check dpop.
The fido2_previewsign backend uses the experimental FIDO2 / CTAP 2.3 previewSign extension to generate and use an on-chip ECDSA P-256 (ES256) key over USB HID without PIV management keys or X.509 certificates.
Warning
previewSign is an experimental draft extension and may change in future
firmware or library releases. Tested on YubiKey 5 Series firmware 5.8+.
Requirements & Real-World Hardware Notes:
-
Compatible CTAP 2.3 authenticator over USB HID: Requires firmware with
previewSignsupport (such as YubiKey 5 Series / Yubico Security Key 5.8+;ykman info). Bluetooth and NFC are not supported for CTAP HID. -
Unattended by default: Key creation requires one physical touch, after which DPoP signatures run silently without prompts (
require_up=Falsedefault; passrequire_up=Trueorrequire_uv=Trueif you want touch or PIN/biometric per sign). -
Provisioning Python dependency: Because GAM does not provision keys, run the one-time key creation command using Python with
dpop-signer-fido2-previewsigninstalled (pip install dpop-signer-fido2-previewsign), saving the public/wrapped credential descriptor intodpop_backend_config(no private key leaves the YubiKey). Once configured, standard GAM builds rungam check dpopandgamnatively. - Windows WebAuthn caveat: Windows may intercept direct FIDO2 USB HID access in some sessions (if HID fails with permission errors, run from an elevated shell or check Windows WebAuthn restrictions).
# Plug in your YubiKey 5.8+ and touch it once when prompted:
CRED=$(python3 -c 'import json; from dpop_signer_fido2_previewsign import generate_signing_credential; print(json.dumps(generate_signing_credential().to_dict(), separators=(",", ":")))')
gam config dpop true dpop_backend fido2_previewsign dpop_backend_config "$CRED" save(If your YubiKey uses a FIDO2 PIN and require_uv=True, append ,prompt to prompt once per command when needed — e.g., "$CRED,prompt" — or ,<PIN> / GAM_DPOP_PIN.)
Proceed to Stage 2: Confirm Local Signing with gam check dpop.
The pkcs11 backend works with PKCS#11 (Cryptoki) hardware security modules and smart cards across Linux, macOS, and Windows using an RFC 7512 pkcs11: URI. Supports ES256 (P-256), ES384 (P-384), and RS256 (RSA).
Real-World Hardware Notes:
-
Discover exact token/key attributes first: Hardware tokens vary in how they populate
token,object(CKA_LABEL),id(CKA_ID), andslot-id. Always inspect the initialized token withpkcs11-tool(from OpenSC) or your vendor CLI before configuring GAM:pkcs11-tool --module /path/to/libpkcs11.so --list-slots pkcs11-tool --module /path/to/libpkcs11.so --login --list-objects
- Percent-encode special characters in URI path fields (for example
id=%01forCKA_ID01,#→%23, space →%20). - Verify your token key is an unrestricted EC P-256/P-384 or RSA signing key (
CKA_SIGN = true).
- Percent-encode special characters in URI path fields (for example
-
Protect your PIN & avoid lockouts: Many HSMs/smart cards permanently lock the User PIN after 3–5 bad attempts. Test your URI/PIN with
pkcs11-tool --login --testfirst, and preferpin-value=prompt(interactive prompt once per command),GAM_DPOP_PIN, orpin-source=file:/path/to/pin(chmod 600) over storing a literalpin-value=ingam.cfg. -
Smartcard reader locks: On USB smart cards/HSMs, ensure
pcscdis running (Linux) and conflicting daemons such asgpg-agent/scdaemonaren't holding exclusive CCID access. -
Note on SoftHSM2: Software PKCS#11 tokens such as SoftHSM2 work for testing, but GAM detects
SoftHSMand printsWARN.
If you haven't created a key on the token yet, initialize/generate one using your HSM tools (or pkcs11-tool --keypairgen --key-type EC:prime256v1 --id 01 --label dpop-key), then verify:
pkcs11-tool --module /path/to/libpkcs11.so --login --list-objectsRFC 7512 pkcs11: URI attributes:
-
Path (
;):token=,object=,id=,slot-id=,serial= -
Query (
&):module-path=(full path to.so/.dylib/.dll),module-name=(p11-kit),pin-source=(file:/path/to/pin),pin-value=
# HSM / PKCS#11 module with separate PIN file (recommended):
gam config dpop true dpop_backend pkcs11 \
dpop_backend_config "pkcs11:token=hsm-slot;object=dpop-key;id=%01?module-path=/path/to/libpkcs11.so&pin-source=file:/home/$USER/.gam/pkcs11-pin.txt" save
# OpenSC smart card resolved via p11-kit module-name:
# gam config dpop true dpop_backend pkcs11 \
# dpop_backend_config "pkcs11:token=MyToken;object=dpop-key?module-name=opensc-pkcs11&pin-value=<PIN>" save(If omitting module-path=/module-name=, set the PKCS11_MODULE environment variable.)
Proceed to Stage 2: Confirm Local Signing with gam check dpop.
The software backend stores an unencrypted EC private key PEM file on disk. It binds oauth2.txt to that file, but an attacker with filesystem access can copy both files — do not use for production. GAM flags software keys with WARN.
openssl ecparam -genkey -name prime256v1 -noout -out ~/.gam/dpop_key.pem
chmod 600 ~/.gam/dpop_key.pem# Relative paths resolve inside your GAM config directory (~/.gam/ by default)
gam config dpop true dpop_backend software dpop_backend_config "dpop_key.pem" saveProceed to Stage 2: Confirm Local Signing with gam check dpop.
Before recreating your OAuth token, run gam check dpop:
gam check dpopWhen configured with a hardware-backed key, output looks like:
DPoP: Enabled (macos_secureenclave)
DPoP Backend Config: gam-dpop
Local DPoP Checks:
Signer Initialization (macos_secureenclave) OK
Key Storage (Hardware: Secure Enclave) OK
Public JWK & Thumbprint (ES256, o-QZ2IXB6M6whv6s...) OK
Local Test Signature (64 bytes, 10.9 ms) OK
DPoP Proof & Signature Verification (ES256) OK
DPoP Local Signing OK
Note: Tests local DPoP signing only; OAuth token binding and server enforcement checks run in "gam oauth info".
What each line checks:
| Check | OK |
WARN |
ERROR |
|---|---|---|---|
Signer Initialization |
Backend loaded & key found | — | Missing key, wrong config/PIN, locked card, or permission error (exits non-zero) |
Key Storage |
Key resides in hardware (Secure Enclave, Microsoft Platform Crypto Provider, TPM 2.0 (...), YubiKey PIV, FIDO2 previewSign, PKCS#11 (...)) |
Key is software-backed (Software TPM, Microsoft Software Key Storage Provider, non-token macOS Keychain, SoftHSM, PEM file) or unverified (ecp) |
— |
Public JWK & Thumbprint |
Valid public key, no private fields exposed, valid thumbprint | — | Invalid/corrupt JWK |
Local Test Signature |
Payload signed & signature verified against public_jwk
|
— | Signing failed or verification failed |
DPoP Proof & Signature Verification |
RFC 9449 dpop+jwt proof created & cryptographically verified |
— | Proof creation or verification failed |
If you see WARN on Key Storage and DPoP Local Signing, your active key is software-backed — replace it with a hardware key in Stage 1 before proceeding to Stage 3.
Common Signer Initialization errors:
| Error | Cause / Fix |
|---|---|
DPoP macOS Secure Enclave error |
Run sc_auth list-ctk-identities as the same macOS user running GAM and verify dpop_backend_config matches the label. |
DPoP Windows Certificate Store error |
Verify the cert exists (Cert:\CurrentUser\My or Cert:\LocalMachine\My with ,local_machine), check certutil for Missing stored keyset, and use thumbprint:<HEX> if multiple certs match. |
DPoP Linux TPM error |
Check ls -l /dev/tpmrm0, id (tss group), tpm2_getcap handles-persistent, and tpm2_readpublic -c <handle>. |
DPoP YubiKey error |
Ensure the YubiKey is plugged in, pcscd is running / scdaemon isn't locking it, and serial,slot,pin is valid. |
DPoP FIDO2 previewSign error |
Ensure a FIDO2 key with firmware 5.8+ (previewSign) is plugged in over USB HID and dpop_backend_config holds valid to_dict() JSON. |
DPoP PKCS#11 error |
Verify module-path=/module-name=, token=/object=/id=, and pin-source=/pin-value= with pkcs11-tool. |
DPoP software key error |
Verify the PEM file path and permissions (chmod 600). |
Note
gam check dpop only tests local DPoP signing — it does not inspect
oauth2.txt or contact Google's OAuth servers. Once gam check dpop reports
DPoP Local Signing OK, proceed to Stage 3.
Existing oauth2.txt refresh tokens created without DPoP remain bearer tokens until replaced. Revoke any existing token and create a new DPoP-bound token:
# Revoke existing unbound credentials (if present)
gam oauth revoke
# Authorize and bind oauth2.txt to your configured DPoP key
gam oauth createThis opens a browser (or prints an authorization URL) for Google authentication. During token exchange, GAM sends a DPoP proof signed by your configured key so Google binds the new refresh token in oauth2.txt to your key's JWK thumbprint.
Caution
After creating DPoP-bound credentials, the refresh token requires that
exact private key for every refresh. If the hardware key is lost, wiped, or
replaced, you must re-authorize with gam oauth revoke and gam oauth create.
Run gam oauth info:
gam oauth infoAlongside Client ID, Scopes, Google Workspace Admin, and Expires, GAM verifies key backing, compares your configured signer against oauth2.txt, and executes live token-endpoint enforcement checks:
...
DPoP: Enabled (macos_secureenclave)
DPoP Backend Config: gam-dpop
DPoP Token Thumbprint: o-QZ2IXB6M6whv6sisQh8oexK6TXMS3xjIPUawxuHrA
DPoP Checks:
Key Storage (Hardware: Secure Enclave) OK
Credential Binding (signer matches oauth2.txt thumbprint) OK
Refresh With DPoP (macos_secureenclave) OK
Reject Refresh Without DPoP OK
Reject Refresh With Wrong Key OK
DPoP Key Binding OK
What each check verifies:
| Check | What It Verifies | Expected Result |
|---|---|---|
Key Storage |
Active key lives in hardware vs. software |
OK for hardware (WARN if software-backed) |
Credential Binding |
Signer thumbprint matches dpop_thumbprint in oauth2.txt
|
OK (ERROR if missing or mismatched) |
Refresh With DPoP (<backend>) |
Configured key refreshes the token at Google's endpoint | OK |
Reject Refresh Without DPoP |
Google rejects an unbound bearer refresh attempt |
OK (ERROR if accepted without proof) |
Reject Refresh With Wrong Key |
Google rejects a proof signed by an unrelated ephemeral key |
OK (ERROR if wrong key accepted) |
DPoP Key Binding |
Overall status across metadata, hardware backing, and server enforcement |
OK (WARN if software key; ERROR + Fix: instructions on failure) |
If dpop = false in gam.cfg while oauth2.txt has a dpop_thumbprint, gam oauth info prints ERROR with Fix: guidance; if dpop = false and oauth2.txt is unbound, it prints WARN recommending hardware DPoP setup.
You can also test Google's enforcement manually with gam oauth refresh:
-
Normal refresh:
gam oauth refreshsucceeds. -
Without DPoP:
gam config dpop false oauth refreshfails (DPoP proof required). -
Wrong key: GAM validates your signer's thumbprint locally against
oauth2.txtbefore calling Google, so pointingdpop_backend_configat another key fails immediately in GAM. Usegam oauth info(Reject Refresh With Wrong Key) to verify Google's server-side wrong-key rejection.
All DPoP settings are stored in gam.cfg:
| Setting | Values | Default | Description |
|---|---|---|---|
dpop |
true / false
|
false |
Enable or disable DPoP |
dpop_backend |
software, macos_secureenclave, windows_certstore, linux_tpm, yubikey, fido2_previewsign, pkcs11, ecp, ephemeral
|
software |
Which signer backend to use |
dpop_backend_config |
(varies by backend) | (empty) | Backend-specific configuration |
| Backend | Format | Example |
|---|---|---|
software |
Path to PEM private key file | dpop_key.pem |
macos_secureenclave |
label[,application_tag] |
gam-dpop |
windows_certstore |
<subject|thumbprint:HEX>[,current_user|local_machine] |
thumbprint:A1B2C3... |
linux_tpm |
handle[,tcti[,auth]] |
0x81000003 or 0x81000003,,prompt
|
yubikey |
serial,slot,pin |
,,prompt or ,,mypin
|
fido2_previewsign |
<credential_json>[,pin] |
{"credential_id":...} or {"credential_id":...},prompt
|
pkcs11 |
RFC 7512 pkcs11: URI |
pkcs11:token=hsm-slot;object=dpop-key?module-path=/path/to/libpkcs11.so&pin-value=prompt |
For any PIN/auth-capable backend (linux_tpm, yubikey, fido2_previewsign, pkcs11), setting the PIN/auth field to prompt causes GAM to prompt interactively once per command when signing is needed (including propagating across csv/batch workers). For non-interactive scripts, you can supply the PIN via the GAM_DPOP_PIN environment variable.
Q: What happens if my TPM/YubiKey/Mac dies?
You'll need to provision a new key (Stage 1), verify local signing with gam check dpop (Stage 2), and re-authorize with gam oauth revoke then gam oauth create (Stage 3). The old refresh token cannot be used without the lost private key.
Q: Can I use the same DPoP key for multiple GAM instances?
Only if they share the same hardware. For example, multiple GAM configs on the same Mac can share one Secure Enclave key label, or multiple hosts can share a network PKCS#11 HSM / portable YubiKey. You cannot share a motherboard TPM key across different machines.
Q: Does DPoP affect GAM performance?
No. GAM only generates a DPoP proof when refreshing its OAuth access token, which happens at most once per hour. Normal Google API calls use the cached access token with zero overhead. A single hardware ECDSA signature takes ~10–75 ms.
Q: Can I switch from software to hardware backend later?
Yes, but you must re-authorize oauth2.txt. Provision your hardware key and update gam.cfg (Stage 1), confirm OK hardware storage with gam check dpop (Stage 2), then run gam oauth revoke, gam oauth create, and gam oauth info (Stage 3).
Q: What if I disable DPoP after creating bound tokens?
The existing refresh token will stop working (Google rejects refresh requests without matching DPoP proofs). Run gam oauth revoke, set gam config dpop false save, then run gam oauth create to obtain an unbound bearer token.
Q: Does the self-signed certificate matter (Windows/YubiKey/macOS)?
No. DPoP signs using the raw private key, not the X.509 certificate. The certificate is only the container used to store and locate the key; certificate expiry does not break DPoP signing.
Update History
Installation
- How to Install GAM7
- How to Upgrade GAMADV-XTD3 to GAM7
- How to Upgrade Legacy GAM to GAM7
- How to Update GAM7
- Verifying a GAM7 Build is Legitimate and Official
- Install GAM as Python Library
- GAM7 on Chrome OS Devices
- GAM7 on Android Devices
- Google Network Addresses
- HTTPS Proxy
- SSL Root CA Certificates
- How to Uninstall GAM7
Configuration
- Authorization
- GAM Configuration
- Running GAM7 securely on a Google Compute Engine
- Using GAM7 with a delegated admin service account
- Using GAM7 with keyless authentication - Workload Identity Federation
- Using GAM7 with a YubiKey
- GAM with minimal GCP rights
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- GAM Public Chat Room
- GAM Scripts
- Code Wiki
- Other Resources
- Drive REST API v3
- BNF Syntax
- GAM Return Codes
- Python Regular Expressions
- Rclone
Definitions
Command Processing
- Bulk Processing
- Command Line Parsing
- Command Logging and Progress
- Command data from Google Docs/Sheets/Storage
- CSV Special Characters
- CSV Input Filtering
- CSV Output Filtering
- Meta Commands and File Redirection
- Permission matches
- Tag Replace
- Todrive
Collections
Client Access
- Addresses
- Administrators
- Alert Center
- Aliases
- Calendars
- Calendars - Access
- Calendars - Events
- Calendars - Secondary Calendars with no Owner
- Chrome Auto Update Expiration Counts
- Chrome Browsers and Enrollment Tokens
- Chrome Device Counts
- Chrome Device Needs Attention Counts
- Chrome Installed Apps
- Chrome Policies
- Chrome Printers
- Chrome Profile Management
- Chrome Version Counts
- Chrome Version History
- ChromeOS Devices
- Classroom - Courses
- Classroom - Guardians
- Classroom - Invitations
- Classroom - Membership
- Classroom - Student Groups
- Cloud Channel
- Cloud Identity Allowlisted Domains
- Cloud Identity Devices
- Cloud Identity Groups
- Cloud Identity Groups - Membership
- Cloud Identity Policies
- Cloud Storage
- Context Aware Access Levels
- Customer
- Domains
- Domains - Verification
- Domain People - Contacts & Profiles
- Domain Shared Contacts
- Email Audit Monitor
- Find File Owner
- Global Address List
- Google Data Transfers
- Groups
- Groups - Membership
- Inbound SSO
- Licenses
- Mobile Devices
- Organizational Units
- Reports
- Reseller
- Resources
- Send Email
- Schemas
- Shared Drives
- Sites
- Unmanaged Accounts
- Users
- Users - Application Specific Passwords
- Users - Backup Verification Codes
- Users - Classroom - Profile
- Users - Contacts - Delegates
- Users - Deprovision
- Users - Group Membership
- Users - Photo
- Users - Profile Sharing
- Users - Signout and Turn off 2-Step Verification
- Users - Tokens
- Vault - Takeout
- Version and Help
Special Service Account Access
Service Account Access
- Users - Analytics Admin
- Users - Business Account Management
- Users - Calendars
- Users - Calendars - Access
- Users - Calendars - Events
- Users - Chat
- Users - Classification Labels
- Users - Contacts
- Users - Data Studio
- Users - Drive - File Selection
- Users - Drive - Activity/Settings
- Users - Drive - Cleanup
- Users - Drive - Comments
- Users - Drive - Copy/Move
- Users - Drive - Files-Display
- Users - Drive - Files-Manage
- Users - Drive - Orphans
- Users - Drive - Ownership
- Users - Drive - Permissions
- Users - Drive - Query
- Users - Drive - Revisions
- Users - Drive - Shortcuts
- Users - Drive - Transfer
- Users - Forms
- Users - Gmail - Client Side Encryption
- Users - Gmail - Delegates
- Users - Gmail - Filters
- Users - Gmail - Forwarding
- Users - Gmail - Labels
- Users - Gmail - Messages/Threads
- Users - Gmail - Profile
- Users - Gmail - S/MIME
- Users - Gmail - SendAs/Signature/Vacation
- Users - Gmail - Settings
- Users - Keep - Notes
- Users - Meet
- Users - Classroom - Profile
- Users - People - Contacts & Profiles
- Users - Profile Photo
- Users - Shared Drives
- Users - Spreadsheets
- Users - Tag Manager
- Users - Tasks
- Users - YouTube
- Users - Web Resources and Sites