Skip to content

Conversation

@tabVersion
Copy link
Contributor

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

This PR introduces the foundational infrastructure and stub implementations for PostgreSQL-compatible PGP encryption and decryption functions: pgp_sym_encrypt, pgp_sym_decrypt, pgp_pub_encrypt, and pgp_pub_decrypt.

The intention is to lay the groundwork for a full implementation of these functions, ensuring compatibility with pgcrypto as per the PostgreSQL documentation. This initial PR focuses on integrating the function signatures into RisingWave's expression system.

Changes include:

  • Adding new ExprNode types for the PGP functions in proto/expr.proto.
  • Creating a new module src/expr/impl/src/scalar/pgp_encrypt.rs to house these functions.
  • Providing placeholder (stub) implementations for all specified PGP functions. These stubs currently return an ExprError::InvalidParam indicating that the functionality is "not yet implemented".
  • Registering the new pgp_encrypt module.
  • Updating frontend components (src/frontend/src/expr/pure.rs and src/frontend/src/optimizer/plan_expr_visitor/strong.rs) to recognize these new function types.

This PR enables the system to parse and recognize the PGP function calls, allowing for incremental development of the actual cryptographic logic in subsequent PRs.

Limitations:
The functions currently only return an error message and do not perform any actual PGP encryption or decryption.

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • I have checked the Release Timeline and Currently Supported Versions to determine which release branches I need to cherry-pick this PR into.

Documentation

  • My PR needs documentation updates.
Release note

Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Dec 15, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

cursoragent and others added 5 commits December 15, 2025 09:19
Adds stub implementations and registers PGP functions in the SQL catalog.

Co-authored-by: tabvision <[email protected]>
This commit adds comprehensive option parsing for PGP encryption and decryption functions, fully matching PostgreSQL's pgcrypto behavior. It includes support for various algorithms, compression, S2K modes, and validation. All 13 unit tests pass, and SQL integration has been verified.

Co-authored-by: tabvision <[email protected]>
…-PGP

This commit completes the implementation of PostgreSQL-compatible `pgp_sym_encrypt` and `pgp_sym_decrypt` functions using the Sequoia-PGP library. It includes support for various cipher and compression algorithms, option parsing, and comprehensive testing. The internal message format is simplified for ease of use, while maintaining API compatibility with PostgreSQL's pgcrypto.

New files include detailed implementation and test cases, ensuring all features are functioning correctly.

Co-authored-by: tabvision <[email protected]>
@tabVersion
Copy link
Contributor Author

close as dep not ready yet...

  Selected cryptographic backend: RustCrypto

  The cryptographic backend RustCrypto does not provide constant-time
  operations.  This has the potential of leaking cryptographic secrets,
  enable attackers to forge signatures, or cause other mayhem.

  If you are not using Sequoia in an interactive setting, using
  variable-time cryptographic operations is probably safe.

  If you know what you are doing, you can opt-in to using variable-time
  cryptographic operations using the feature flag

      allow-variable-time-crypto

  See https://crates.io/crates/sequoia-openpgp#crypto-backends
warning: build failed, waiting for other jobs to finish...

@tabVersion tabVersion closed this Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants