feat(go-sdk): add RA-TLS certificate verification package#512
Open
Leechael wants to merge 1 commit intofeature-sdk-golangfrom
Open
feat(go-sdk): add RA-TLS certificate verification package#512Leechael wants to merge 1 commit intofeature-sdk-golangfrom
Leechael wants to merge 1 commit intofeature-sdk-golangfrom
Conversation
Add sdk/go/ratls as a separate Go module providing RA-TLS certificate verification for dstack TEE applications. The implementation matches the Rust ra-tls/dstack-attest verification chain: - Extract TDX quote from X.509 certificate extension (OID 1.3.6.1.4.1.62397.1.1) - Verify quote via dcap-qvl (fetch collateral from PCCS + verify Intel signature) - Validate TCB attributes (reject debug mode, check mr_signer_seam/mr_service_td) - Verify report_data binds to certificate public key (SHA512 of "ratls-cert:" prefix) - Replay RTMR3 from event log and compare with quote Exposed API: - VerifyCert(cert, opts...) - verify a single X.509 certificate - TLSConfig(opts...) - return *tls.Config for RA-TLS handshake verification - WithPCCSURL / WithOnVerified options Uses github.com/Phala-Network/dcap-qvl/golang-bindings for quote parsing and verification. Separate go.mod keeps the dcap-qvl CGO dependency isolated from the base SDK module.
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
sdk/go/ratlspackage for RA-TLS (Remote Attestation TLS) certificate verification, enabling Go applications to verify that a TLS peer is running inside a genuine TDX TEE.Verification chain (matches Rust
ra-tls/dstack-attest)1.3.6.1.4.1.62397.1.1)mr_signer_seam/mr_service_tdare zeroreport_databinds to certificate public key —SHA512("ratls-cert:" || SubjectPublicKeyInfo DER)1.3.6.1.4.1.62397.1.2) — filterevent_type == 0x08000001, computeSHA384(event_type_le_bytes || ":" || event || ":" || payload), accumulatemr = SHA384(mr || digest)API
Module structure
sdk/go/ratlsis a separate Go module (sdk/go/ratls/go.mod) to isolate thedcap-qvlCGO dependency from the base SDK module. This avoids pullinggo-ethereumand other unrelated transitive dependencies into the basesdk/go/go.mod.Consistency with Rust
CertExt::get_extension_bytes()+yasna::parse_dergetExtensionBytes()+asn1.Unmarshaldcap_qvl::verify()dcap.GetCollateralAndVerify()validate_tcb()indstack-attestvalidateTCB()QuoteContentType::RaTlsCert.to_report_data()SHA512("ratls-cert:" || RawSubjectPublicKeyInfo)replay_runtime_events::<Sha384>()verifyRTMR3()RuntimeEvent::digest::<Sha384>()withto_ne_bytes()(LE on x86_64)binary.LittleEndian.PutUint32serde_human_bytesdcap.HexBytesTest plan
go build -tags ratls