NVIDIA Attestation SDK Migration Guide#

Python SDK to C++ SDK (NVAT)#

The Python Attestation SDK is deprecated as of March 15, 2026. This guide walks you through migrating to the replacement NVIDIA Attestation SDK (NVAT), written in C++.

End of support: September 15, 2026 — after this date, the Python SDK will receive no fixes, security patches, or official support.


Table of Contents#


Deprecation Timeline#

Milestone

Date

Impact

Deprecation

March 15, 2026

No new features; critical security patches only

End of support

September 15, 2026

No fixes, patches, or official support


Migration Paths#

Choose the path that matches your current usage:

cc_admin CLI users#

If you use cc_admin (the local GPU verifier CLI) to perform attestation from the command line, migrate to the nvattest CLI — the C++ SDK’s command-line tool.

nvattest is a drop-in replacement that supports local and remote GPU/NVSwitch attestation from the command line. See the nvattest CLI documentation for usage and installation.

PPCIE Verifier users#

If you use nv-ppcie-verifier v1.x (the Python SDK-based PPCIE verifier), migrate to nv-ppcie-verifier v2.x (ppcie-verifier-sdk-cpp), which uses nvattest internally instead of the Python SDK.

The v2.x verifier provides the same PPCIE verification workflow with no Python SDK dependency. See the PPCIE Verifier v2 documentation for installation and usage.

Python SDK API users#

If you import nv_attestation_sdk in your Python code, you have two migration options:

  • nvattest CLI (simpler) — Call the nvattest command-line tool from your application. Best for scripts, orchestration, and cases where you just need attestation results. See the nvattest CLI documentation.

  • C API (programmatic) — Link against libnvat and use the C API directly. Best for applications that need fine-grained control over attestation flows. Follow the C++ SDK installation guide, then use the API mapping and examples below.


API Mapping Reference#

The table below maps common Python SDK operations to their C++ SDK (C API) equivalents.

Operation

Python SDK

C++ SDK (C API)

Import

from nv_attestation_sdk import attestation

#include <nvat.h>

Initialize

client = attestation.Attestation()

nvat_sdk_opts_create()nvat_sdk_init()nvat_attestation_ctx_create()

Set service key

client.set_service_key(key)

nvat_attestation_ctx_set_service_key()

Set nonce

client.set_nonce(hex_str)

nvat_nonce_from_hex() — nonce is then passed to nvat_attest_device() directly, not stored on context

GPU + local verifier

client.add_verifier(Devices.GPU, Environment.LOCAL, "", "")

nvat_attestation_ctx_set_device_type(NVAT_DEVICE_GPU) + nvat_attestation_ctx_set_verifier_type(NVAT_VERIFY_LOCAL)

GPU + remote verifier

client.add_verifier(Devices.GPU, Environment.REMOTE, url, "")

nvat_attestation_ctx_set_verifier_type(NVAT_VERIFY_REMOTE) + nvat_attestation_ctx_set_default_nras_url()

NVSwitch device

client.add_verifier(Devices.SWITCH, ...)

nvat_attestation_ctx_set_device_type(NVAT_DEVICE_SWITCH)

Collect evidence

client.get_evidence()

nvat_gpu_evidence_collect() or nvat_switch_evidence_collect() (specific use only — see note below)

Attest

client.attest(evidence)

nvat_attest_device(ctx, nonce, &eat, &claims)

Get token

client.get_token()

eat output from nvat_attest_device()

Validate policy

client.validate_token(json_policy)

nvat_relying_party_policy_create_rego_from_str() + nvat_apply_relying_party_policy() (post-attestation), or attach to context via nvat_attestation_ctx_set_relying_party_policy() (evaluated during attestation)

Inspect claims

client.decode_token(token)

nvat_claims_collection_serialize_json(claims, &json)

Cleanup

N/A (garbage collected)

nvat_str_free() + nvat_claims_collection_free() + nvat_attestation_ctx_free() + nvat_sdk_opts_free() + nvat_sdk_shutdown()

Note on evidence collection: In most cases, use nvat_attest_device() — it handles both evidence collection and verification internally. Use nvat_gpu_evidence_collect() / nvat_switch_evidence_collect() only for workflows where you need to inspect, serialize, or transport evidence before verification. For pre-collected evidence, you can set a JSON source via nvat_attestation_ctx_set_gpu_evidence_source_json_file() or use the low-level nvat_verify_gpu_evidence().


Key Differences#

  1. Explicit resource management — All resources follow the pattern: create → use → free. There is no garbage collection; you must free every object you create.

  2. Return codes instead of exceptions — The C API returns nvat_rc_t status codes. Always check return values:

    nvat_rc_t rc = nvat_attest_device(ctx, NULL, &eat, &claims);
    if (rc != NVAT_RC_OK) {
        fprintf(stderr, "Attestation failed: %d\n", rc);
        // handle error...
    }
    
  3. Policy language change — Python uses JSON-based authorization rules; C++ uses Rego (Open Policy Agent) policies evaluated during attestation.

  4. GPU ready state management — The Python SDK automatically sets the GPU ready state via NVML after attestation. The C++ SDK does not manage GPU ready state. If your workflow depends on this, you will need to handle it separately using NVML APIs.


Logging#

The Python SDK automatically writes logs to attestation_sdk.log in the current working directory. The C++ SDK provides a pluggable logging interface instead.

Built-in logger (stdout):

nvat_logger_t logger = NULL;
nvat_logger_spdlog_create(&logger, "nvat", NVAT_LOG_LEVEL_INFO);

nvat_sdk_opts_t opts = NULL;
nvat_sdk_opts_create(&opts);
nvat_sdk_opts_set_logger(opts, logger);
nvat_sdk_init(opts);

Custom logger (e.g., write to file):

Use nvat_logger_callback_create() to provide your own log callback that writes to a file or integrates with your application’s logging framework. See the C++ SDK documentation for details.


Migration Examples#

Local GPU Attestation#

Before (Python):

from nv_attestation_sdk import attestation

client = attestation.Attestation()
client.set_name("myNode")
client.add_verifier(attestation.Devices.GPU,
                    attestation.Environment.LOCAL, "", "")

evidence = client.get_evidence()
result = client.attest(evidence)
token = client.get_token()
print("Attestation passed:", result)

After (C):

#include <nvat.h>
#include <stdio.h>

int main(void) {
    nvat_sdk_opts_t opts = NULL;
    nvat_attestation_ctx_t ctx = NULL;
    nvat_str_t eat = NULL;
    nvat_claims_collection_t claims = NULL;

    // Initialize the SDK
    nvat_sdk_opts_create(&opts);
    nvat_sdk_init(opts);
    nvat_attestation_ctx_create(&ctx);

    // Attest (local GPU is the default)
    nvat_rc_t rc = nvat_attest_device(ctx, NULL, &eat, &claims);
    printf("Attestation %s\n", rc == NVAT_RC_OK ? "passed" : "failed");

    // Cleanup — always free in reverse order of creation
    nvat_str_free(&eat);
    nvat_claims_collection_free(&claims);
    nvat_attestation_ctx_free(&ctx);
    nvat_sdk_opts_free(&opts);
    nvat_sdk_shutdown();

    return rc == NVAT_RC_OK ? 0 : 1;
}

Remote GPU Attestation#

Before (Python):

from nv_attestation_sdk import attestation
import os

NRAS_URL = "https://nras.attestation.nvidia.com/v4/attest/gpu"

client = attestation.Attestation()
client.set_name("myNode")
client.set_service_key(os.getenv("NVIDIA_ATTESTATION_SERVICE_KEY"))
client.add_verifier(attestation.Devices.GPU,
                    attestation.Environment.REMOTE, NRAS_URL, "")

evidence = client.get_evidence()
result = client.attest(evidence)
token = client.get_token()

After (C):

#include <nvat.h>
#include <stdlib.h>
#include <stdio.h>

int main(void) {
    nvat_sdk_opts_t opts = NULL;
    nvat_attestation_ctx_t ctx = NULL;
    nvat_str_t eat = NULL;
    nvat_claims_collection_t claims = NULL;

    // Initialize the SDK
    nvat_sdk_opts_create(&opts);
    nvat_sdk_init(opts);
    nvat_attestation_ctx_create(&ctx);

    // Configure remote attestation (SDK uses the default NRAS URL)
    nvat_attestation_ctx_set_verifier_type(ctx, NVAT_VERIFY_REMOTE);

    const char *key = getenv("NVIDIA_ATTESTATION_SERVICE_KEY");
    if (key) {
        nvat_attestation_ctx_set_service_key(ctx, key);
    } else {
        fprintf(stderr, "Warning: NVIDIA_ATTESTATION_SERVICE_KEY not set\n");
    }

    // Attest
    nvat_rc_t rc = nvat_attest_device(ctx, NULL, &eat, &claims);
    printf("Attestation %s\n", rc == NVAT_RC_OK ? "passed" : "failed");

    // Cleanup
    nvat_str_free(&eat);
    nvat_claims_collection_free(&claims);
    nvat_attestation_ctx_free(&ctx);
    nvat_sdk_opts_free(&opts);
    nvat_sdk_shutdown();

    return rc == NVAT_RC_OK ? 0 : 1;
}

Policy Validation#

The C++ SDK supports two approaches for policy validation:

  • Attach to context (recommended) — set the policy before calling nvat_attest_device(), which evaluates it automatically. This is shown in the example below.

  • Post-attestation — call nvat_apply_relying_party_policy(policy, claims) after attestation to evaluate the policy against the returned claims.

Before (Python):

import json

# After attestation (see above)...
with open("policy.json") as f:
    policy = json.dumps(json.load(f))

is_valid = client.validate_token(policy)
print("Policy match:", is_valid)

After (C):

#include <nvat.h>
#include <stdio.h>

// Rego policy (replaces JSON-based policy from the Python SDK)
const char *rego_policy =
    "package policy\n"
    "import future.keywords.every\n"
    "default nv_match := false\n"
    "nv_match {\n"
    "  every result in input {\n"
    "    result[\"x-nvidia-device-type\"] == \"gpu\"\n"
    "    result.secboot\n"
    "    result.dbgstat == \"disabled\"\n"
    "  }\n"
    "}\n";

int main(void) {
    nvat_sdk_opts_t opts = NULL;
    nvat_attestation_ctx_t ctx = NULL;
    nvat_str_t eat = NULL;
    nvat_claims_collection_t claims = NULL;

    // Initialize the SDK
    nvat_sdk_opts_create(&opts);
    nvat_sdk_init(opts);
    nvat_attestation_ctx_create(&ctx);

    // Attach Rego policy BEFORE calling nvat_attest_device()
    nvat_relying_party_policy_t rp = NULL;
    nvat_relying_party_policy_create_rego_from_str(&rp, rego_policy);
    nvat_attestation_ctx_set_relying_party_policy(ctx, rp);
    nvat_relying_party_policy_free(&rp);

    // Policy is evaluated during attestation
    // NVAT_RC_OK              = attestation + policy passed
    // NVAT_RC_RP_POLICY_MISMATCH = attestation passed, policy failed
    nvat_rc_t rc = nvat_attest_device(ctx, NULL, &eat, &claims);
    printf("Attestation %s\n", rc == NVAT_RC_OK ? "passed" : "failed");

    // Cleanup
    nvat_str_free(&eat);
    nvat_claims_collection_free(&claims);
    nvat_attestation_ctx_free(&ctx);
    nvat_sdk_opts_free(&opts);
    nvat_sdk_shutdown();

    return rc == NVAT_RC_OK ? 0 : 1;
}

Resources#

Resource

Link

C++ SDK Repository

github.com/NVIDIA/attestation-sdk

C++ SDK Documentation

docs.nvidia.com

PPCIE Verifier v2 Documentation

docs.nvidia.com

Issue Tracker

github.com/NVIDIA/attestation-sdk/issues

Email Support

attestation-support@nvidia.com