Skip to content

Add AWS Nitro attestation verification module#971

Open
mskd12 wants to merge 5 commits into
mainfrom
nitro-attestation
Open

Add AWS Nitro attestation verification module#971
mskd12 wants to merge 5 commits into
mainfrom
nitro-attestation

Conversation

@mskd12

@mskd12 mskd12 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Moves AWS Nitro enclave attestation verification out of the sui monorepo (crates/sui-types/src/nitro_attestation.rs) into the core fastcrypto crate, so other consumers can use it without cloning sui. Verification covers COSE_Sign1 (RFC 8152) CBOR parsing, attestation-document validation, and X.509 chain verification against the AWS Nitro root CA with P-384 ECDSA.

The port is intentionally minimal — this is consensus-critical verification code, so the diff against the sui original is kept to mechanical changes only:

  • License header gains the year (required by scripts/license_check.sh); added a module doc comment.
  • Error plumbing decoupled from sui: SuiError/SuiErrorKind/SuiResult removed. The NitroAttestationVerifyError enum is retained (now a thiserror derive with byte-identical Display strings) and stays public.
  • Public entry points return FastCryptoResult, matching the rest of the crate; private helpers still produce the typed NitroAttestationVerifyError, bridged at the boundary via From<NitroAttestationVerifyError> for FastCryptoError.
  • Two edition-2024 let-chains rewritten as nested ifs (fastcrypto is edition 2021).
  • nitro_root_certificate.pem copied byte-for-byte.

The public API (including the three parsing bool flags is_upgraded_parsing / include_all_nonzero_pcrs / always_include_required_pcrs) is kept verbatim so the sui-side migration is a pure re-export + deletion.

Test plan

  • cargo test -p fastcrypto nitro_attestation — 7/7 pass (parse/verify round-trips on real attestations, cert expiry windows, malformed CBOR, mutation tests).
  • cargo xclippy and cargo fmt --all --check — clean.

Follow-up (separate sui PR, out of scope)

After this merges and sui bumps its fastcrypto pin: replace crates/sui-types/src/nitro_attestation.rs with pub use fastcrypto::nitro_attestation::*;, drop the orphaned From<NitroAttestationVerifyError> for SuiError impl, and move the unit tests over. The move-native callers match Err(_) and compile unchanged.

🤖 Generated with Claude Code

mskd12 and others added 3 commits June 5, 2026 17:16
Port of sui-types' nitro_attestation: COSE_Sign1 parsing, attestation
document validation and certificate chain verification against the AWS
Nitro root of trust. Moved here so consumers don't need the sui repo.

Changes from the sui original: SuiError plumbing replaced with
NitroAttestationVerifyError as the public error type; let-chains
rewritten for edition 2021. API and verification logic are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the hand-written Display impl with a thiserror derive (identical
output strings) and bridge into FastCryptoError::GeneralError so the
module composes with FastCryptoResult APIs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Switch parse_nitro_attestation/verify_nitro_attestation to FastCryptoResult
so the public API matches the rest of the crate. The NitroAttestationVerifyError
enum stays public and is produced by the private helpers; the From bridge into
FastCryptoError now carries the conversion at the entry-point boundary.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mskd12 mskd12 requested review from benr-ml and joyqvq June 9, 2026 23:07
@mskd12 mskd12 marked this pull request as ready for review June 9, 2026 23:07
mskd12 and others added 2 commits June 9, 2026 16:11
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant