Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Add decryption with existing asymmetric keys #112

Open
IceManGreen opened this issue Jan 15, 2025 · 1 comment
Open

[NEW] Add decryption with existing asymmetric keys #112

IceManGreen opened this issue Jan 15, 2025 · 1 comment
Assignees

Comments

@IceManGreen
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, there is no way to decrypt data from asymmetric keys that already exist.
This is due to the functions :

  • FindKeyPair
  • FindKeyPairs
  • FindKeyPairWithAttributes
  • FindKeyPairsWithAttributes
  • FindAllKeyPairs

which only return Signer type or array of this type.
As a consequence, looking for an existing key pair in a KMS results only in signing operations and not decryption operations.
Encryption remains possible by getting the public key of the asymmetric pair with signer.Public().

This is mostly due to the function makeKeyPair that builds pkcs11PrivateKeyDSA, pkcs11PrivateKeyRSA and pkcs11PrivateKeyECDSA but returns a Signer type instead, preventing any Decrypt function to be called from this type.

Describe the solution you'd like

The methods :

  • makeKeyPair
  • FindKeyPair
  • FindKeyPairs
  • FindKeyPairWithAttributes
  • FindKeyPairsWithAttributes
  • FindAllKeyPairs

should return a SignerDecrypter type instead of a Signer type to allow decryption operations from existing keypairs in pkcs11 stores.

@IceManGreen
Copy link
Contributor Author

Related to #111
The solution proposed in this pull request might be the solution and need to be discussed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant