Skip to content

Conversation

@randilt
Copy link

@randilt randilt commented Oct 3, 2025

Purpose

This PR adds a Ballerina Enhancement Proposal (BEP) for RSASSA-PSS (PS256) signature support in the Ballerina crypto module. The current crypto library only supports classic RSA signatures using PKCS#1 v1.5 padding, limiting developers who need modern cryptographic standards like JWT PS256, OAuth 2.0, and other security protocols that require or prefer RSASSA-PSS signatures.

Resolves #8292

Goals

  • Document the technical specification for adding RSASSA-PSS signature generation and verification APIs to the Ballerina crypto module
  • Provide comprehensive analysis of implementation approach, and design decisions
  • Establish the roadmap for enabling PS256 support in higher-level modules like JWT
  • Follow the standardized BEP process for platform-wide enhancements

Related PRs

@daneshk daneshk requested a review from Copilot October 5, 2025 06:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a Ballerina Enhancement Proposal (BEP) for RSASSA-PSS (PS256) signature support in the Ballerina crypto module. The current implementation only supports classic RSA signatures using PKCS#1 v1.5 padding, but modern security protocols increasingly require or prefer RSASSA-PSS signatures.

  • Creates comprehensive technical specification for adding RSASSA-PSS signature generation and verification APIs
  • Proposes API design following existing crypto module patterns with signRsaSsaPss256 and verifyRsaSsaPss256Signature functions
  • Documents implementation architecture, risks, dependencies, and future roadmap for PS256 support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


Two new functions will be added to the `crypto` module following the exact naming pattern of existing RSA signature functions:

````ballerina
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

Use triple backticks (```) instead of quadruple backticks (````) for code blocks. Quadruple backticks are non-standard markdown syntax.

Suggested change
````ballerina
```ballerina

Copilot uses AI. Check for mistakes.
# + privateKey - Private key used for signing
# + return - The generated signature or else a `crypto:Error` if the private key is invalid
public isolated function signRsaSsaPss256(byte[] input, PrivateKey privateKey) returns byte[]|Error;
````
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

Use triple backticks (```) instead of quadruple backticks (````) for code block closing. Quadruple backticks are non-standard markdown syntax.

Suggested change
````

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +86
````

````ballerina
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

Use triple backticks (```) instead of quadruple backticks (````) for code blocks. Quadruple backticks are non-standard markdown syntax.

Suggested change
````
````ballerina

Copilot uses AI. Check for mistakes.
# + publicKey - Public key used for verification
# + return - Validity of the signature or else a `crypto:Error` if the public key is invalid
public isolated function verifyRsaSsaPss256Signature(byte[] data, byte[] signature, PublicKey publicKey) returns boolean|Error;
````
Copy link

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

Use triple backticks (```) instead of quadruple backticks (````) for code block closing. Quadruple backticks are non-standard markdown syntax.

Suggested change
````

Copilot uses AI. Check for mistakes.
@daneshk
Copy link
Member

daneshk commented Oct 5, 2025

@randilt add minor comments, please check

Co-authored-by: Danesh Kuruppu <daneshk@users.noreply.github.com>
@randilt
Copy link
Author

randilt commented Oct 5, 2025

@randilt add minor comments, please check

Applied the suggestions and intentionally kept the additional backticks (ignored copilot suggestions). The outer four backticks are needed because the code block itself contains triple backticks.

@daneshk
Copy link
Member

daneshk commented Oct 5, 2025

@randilt add minor comments, please check

Applied the suggestions and intentionally kept the additional backticks (ignored copilot suggestions). The outer four backticks are needed because the code block itself contains triple backticks.

However, we typically use triple backticks for code blocks in other proposals.

@daneshk
Copy link
Member

daneshk commented Oct 23, 2025

@randilt, shall we have triple backticks to be consistent with others? Can you do that? Proposal LGTM

@randilt
Copy link
Author

randilt commented Oct 28, 2025

@randilt, shall we have triple backticks to be consistent with others? Can you do that? Proposal LGTM

Sure @daneshk I will update this

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.

Add support for RSASSA-PSS (PS256) algorithm

2 participants