Skip to content

Azure Key Vault authentication fails with S2S12005 error while using valid credentials #287

@TDYMueller

Description

@TDYMueller

Issue Description

When attempting to use Jsign with Azure Key Vault, authentication fails with error S2S12005, even though the same credentials work correctly with AzureSignTool.

Steps to Reproduce

  1. Install Jsign 7.1
  2. Run the following command:
jsign \
  --storetype AZUREKEYVAULT \
  --keystore https://[vault-name].vault.azure.net \
  --alias "[certificate-name]" \
  --storepass "tenantId=[tenant-id],clientId=[client-id],clientSecret=[client-secret]" \
  --debug \
  test.js

Current Behavior

  • Jsign attempts to access Key Vault directly without first obtaining an Azure AD token
  • Returns 401 Unauthorized with error code S2S12005
  • Debug output shows:
GET https://[vault-name].vault.azure.net/certificates/[cert-name]?api-version=7.2
Response Code: 401
Error: {"error":{"code":"Unauthorized","message":"[BearerReadAccessTokenFailed] Error validating token: 'S2S12005'."}}

Expected Behavior

  • Jsign should first obtain an OAuth token from login.microsoftonline.com
  • Then use that token to authenticate with Azure Key Vault
  • Successfully access the certificate (as AzureSignTool does with the same credentials)

Evidence

  1. The same credentials work perfectly with AzureSignTool:
azuresigntool sign --kvu https://[vault-name].vault.azure.net/ --kvc [cert-name] \
  --azure-key-vault-client-id [client-id] \
  --azure-key-vault-tenant-id [tenant-id] \
  --kvs [client-secret] \
  --timestamp-rfc3161 http://timestamp.digicert.com ./test.js
  1. Azure Key Vault logs show:
  • Authentication attempt results in 401
  • No prior token acquisition attempt
  • Operation logs confirm missing OAuth token

Environment

  • OS: Linux
  • Jsign version: 7.1

Additional Notes

The issue appears to be in Jsign's Azure authentication implementation. AzureSignTool uses the official Azure Identity libraries which handle the complete OAuth flow, while Jsign seems to be attempting direct access without proper token acquisition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions