Skip to content

Add crypto.Signer support for KMS/HSM keys#6

Merged
dineshudayakumar merged 2 commits intomainfrom
crypto-signer-support
Feb 24, 2026
Merged

Add crypto.Signer support for KMS/HSM keys#6
dineshudayakumar merged 2 commits intomainfrom
crypto-signer-support

Conversation

@dineshudayakumar
Copy link
Copy Markdown

@dineshudayakumar dineshudayakumar commented Jan 15, 2026

Summary

Add crypto.Signer support for KMS/HSM
Check public key type instead of private key type to support
crypto.Signer implementations (e.g. GCP KMS, AWS KMS, HSM)
that aren't concrete *rsa.PrivateKey or *ecdsa.PrivateKey types.

Supports RSA (RS256/RS384/RS512), RSA-PSS (PS256/PS384/PS512),
ECDSA (ES256/ES384/ES512), and EdDSA signing methods via
crypto.Signer for JWT session and tracked request signing.

@dineshudayakumar dineshudayakumar force-pushed the crypto-signer-support branch 2 times, most recently from 3b7da22 to 4a22109 Compare January 15, 2026 20:05
@kmansou
Copy link
Copy Markdown

kmansou commented Jan 20, 2026

I removed integration with Reviewable on this repo

@dineshudayakumar dineshudayakumar force-pushed the crypto-signer-support branch 3 times, most recently from 504881c to d878cf8 Compare January 20, 2026 20:12
Copy link
Copy Markdown

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 enables support for hardware security modules (HSM) and cloud Key Management Systems (KMS) by allowing the use of crypto.Signer interface implementations instead of requiring concrete *rsa.PrivateKey or *ecdsa.PrivateKey types.

Changes:

  • Updated key type validation to check public key type instead of private key type, enabling KMS/HSM signer support
  • Implemented custom JWT signing fallback using crypto.Signer interface for keys that aren't concrete private key types
  • Added ECDSA signature format conversion from ASN.1 DER to JWT's raw R||S format

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
service_provider.go Updated key validation to check public key type instead of private key type
samlsp/session_jwt.go Added custom JWT signing for crypto.Signer implementations with ECDSA signature conversion
samlsp/request_tracker_jwt.go Added fallback to custom signing for crypto.Signer implementations
samlsp/new.go Updated default signing method selection to check public key type
samlsp/middleware_test.go Added comprehensive end-to-end tests using mock crypto.Signer

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dineshudayakumar dineshudayakumar force-pushed the crypto-signer-support branch 2 times, most recently from 9f655f0 to 9399db6 Compare January 23, 2026 17:00
@eriksw eriksw requested a review from Copilot February 4, 2026 18:30
Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eriksw eriksw requested a review from Copilot February 5, 2026 17:57
Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Using `go-version: stable` resolved to Go 1.26, but go.mod declares
go 1.24.0. golangci-lint was picking up a file from the Go 1.26
toolchain's own vendor directory:

  golang.org/x/crypto/chacha20poly1305/fips140only_go1.26.go

This file has a `//go:build go1.26` constraint, which causes a typecheck
failure when the module is built with go 1.24. That failure cascades
into false-positive errors across the codebase.

Switching to `go-version-file: go.mod` pins CI to the Go version
declared in go.mod, ensuring toolchain and module version stay in sync.
Copy link
Copy Markdown

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Check public key type instead of private key type to support
crypto.Signer implementations (e.g. GCP KMS, AWS KMS, HSM)
that aren't concrete *rsa.PrivateKey or *ecdsa.PrivateKey types.

Supports RSA (RS256/RS384/RS512), RSA-PSS (PS256/PS384/PS512),
ECDSA (ES256/ES384/ES512), and EdDSA signing methods via
crypto.Signer for JWT session and tracked request signing.
Copy link
Copy Markdown

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dineshudayakumar dineshudayakumar merged commit 2e8c011 into main Feb 24, 2026
8 checks passed
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.

5 participants