Skip to content

feat(spanner): add OPAQUE cryptographic engine and protobufs for Omni authentication - #18300

Open
sagnghos wants to merge 2 commits into
googleapis:mainfrom
sagnghos:sagnghos/omni-opaque-crypto
Open

feat(spanner): add OPAQUE cryptographic engine and protobufs for Omni authentication#18300
sagnghos wants to merge 2 commits into
googleapis:mainfrom
sagnghos:sagnghos/omni-opaque-crypto

Conversation

@sagnghos

@sagnghos sagnghos commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

This is PR 1 of 3 breaking down the Spanner Omni authentication feature into smaller, reviewable increments.

Reference: #18273

This PR adds:

  • Protobuf definitions and gRPC service stubs for Spanner Omni authentication and login services (authentication_pb2*, login_pb2*).
  • Core OPAQUE protocol cryptographic primitives (opaque.py), including NIST P-256 elliptic curve arithmetic, RFC 9380 expand_message_xmd and Simplified SWU hash-to-curve, Argon2id stretch key stretching, Diffie-Hellman key exchange, envelope recovery, and the client UserAuthenticator state machine.
  • cryptography >= 44.0.0 requirement for Argon2 support.
  • Comprehensive unit tests (test_opaque.py) achieving 100% statement and branch coverage.

Related PRs

  • PR 1 (This PR): OPAQUE Crypto Engine & Protobufs
  • PR 2 (Follow-up): Omni Login Client, Credentials & gRPC Interceptors
  • PR 3 (Follow-up): Spanner Client, Async Client & DBAPI Integration

@sagnghos
sagnghos requested a review from a team as a code owner September 8, 2026 13:52

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces OPAQUE protocol cryptographic utilities and connection helpers for Spanner Omni authentication, including P-256 elliptic curve operations, hash-to-curve mapping, and a UserAuthenticator class. The review feedback highlights three key areas for improvement: resolving a runtime TypeError caused by concatenating bytes and bytearray in expand_message_xmd, enforcing a minimum hash_size of 8 bytes to prevent downstream Argon2id salt length errors, and implementing a clear method and destructor on UserAuthenticator to securely zeroize sensitive cryptographic state in memory if a handshake is aborted.

Comment thread packages/google-cloud-spanner/google/cloud/spanner_v1/omni/opaque.py Outdated
Comment thread packages/google-cloud-spanner/google/cloud/spanner_v1/omni/opaque.py Outdated
@sagnghos
sagnghos force-pushed the sagnghos/omni-opaque-crypto branch 2 times, most recently from 9022598 to db5d34d Compare September 8, 2026 14:02
… authentication

- Add generated protobuf and gRPC definitions for Omni authentication and login
- Add OPAQUE protocol cryptographic primitives, RFC 9380 hash-to-curve, Argon2id stretch, and key derivation
- Add UserAuthenticator state machine for initial and final request generation
- Add cryptography >= 44.0.0 dependency
- Add comprehensive unit tests achieving 100% statement and branch coverage
@sagnghos
sagnghos force-pushed the sagnghos/omni-opaque-crypto branch from db5d34d to bd9007b Compare September 8, 2026 14:10
@rahul2393 rahul2393 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 8, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 8, 2026
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.

3 participants