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:
nvattestCLI (simpler) — Call thenvattestcommand-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
libnvatand 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 |
|
|
Initialize |
|
|
Set service key |
|
|
Set nonce |
|
|
GPU + local verifier |
|
|
GPU + remote verifier |
|
|
NVSwitch device |
|
|
Collect evidence |
|
|
Attest |
|
|
Get token |
|
|
Validate policy |
|
|
Inspect claims |
|
|
Cleanup |
N/A (garbage collected) |
|
Note on evidence collection: In most cases, use
nvat_attest_device()— it handles both evidence collection and verification internally. Usenvat_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 vianvat_attestation_ctx_set_gpu_evidence_source_json_file()or use the low-levelnvat_verify_gpu_evidence().
Key Differences#
Explicit resource management — All resources follow the pattern: create → use → free. There is no garbage collection; you must free every object you create.
Return codes instead of exceptions — The C API returns
nvat_rc_tstatus 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... }
Policy language change — Python uses JSON-based authorization rules; C++ uses Rego (Open Policy Agent) policies evaluated during attestation.
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 |
|
C++ SDK Documentation |
|
PPCIE Verifier v2 Documentation |
|
Issue Tracker |
|
Email Support |
attestation-support@nvidia.com |