apache / apache/pulsar-client-go

Support ECDSA message-level encryption in GO client

Open
#1,012 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
745
Forks
389
Avg merge
3d 20h
Merged PRs (30d)
3

Description

**Is your feature request related to a problem? Please describe.**
A [comment in the KeyReader interface code](https://github.com/apache/pulsar-client-go/blob/branch-0.10.0/pulsar/crypto/crypto_key_reader.go#L21) implies that both RSA and ECDSA are supported in the GO client.

However, [this function](https://github.com/apache/pulsar-client-go/blob/branch-0.10.0/pulsar/crypto/default_message_crypto.go#L329) doesn't seem to actually have the code to properly load an elliptic curve private key. In fact the code seems to make an explicit reference to parsing the data as PKCS#1 which is not a relevant format for elliptic curves.

FYI, The current Apache Pulsar website actually shows the GO code for message-level encryption with ECDSA, however if you run the code with the latest GO client library (0.10) you will get the error:
`x509: failed to parse private key (use ParseECPrivateKey instead for this key format)`

As far as I can tell ECDSA has never been supported in the GO client and I'm not sure why the docs reflect that it is supported.

**Describe the solution you'd like**
Add support for ECDSA keys. The crypto library that the GO client is using already supports ECDSA so it should be easier than adding the support to another client like the C++/Python clients.

**Describe alternatives you've considered**
N/A

**Additional context**
N/A

Contributor guide

Open the contributing guide

Research direction

Start with pulsar/crypto/crypto_key_reader.go and the key-loading code in pulsar/crypto/default_message_crypto.go around the referenced function at line 329. Reproduce the documented ECDSA message-encryption example with client library 0.10, then inspect the existing RSA path and Go x509 parsing behavior. Done means ECDSA private keys load successfully and the relevant encryption flow and tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cryptography
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.