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

Support Encrypted Private Key PEM Format #550

Open
CMCDragonkai opened this issue Aug 14, 2023 · 2 comments
Open

Support Encrypted Private Key PEM Format #550

CMCDragonkai opened this issue Aug 14, 2023 · 2 comments
Labels
enhancement New feature or request r&d:polykey:core activity 2 Cross Platform Cryptography for JavaScript Platforms

Comments

@CMCDragonkai
Copy link
Member

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

Currently our root key and asymmetric key crypto uses JWK.

However there's an older format "encrypted PKCS#8 pem" that is more widely understood.

We can support a function in our keys utils called:

privateKeyToPEMEncrypted
privateKeyFromPEMEncrypted

Describe the solution you'd like

See the notes:

Describe alternatives you've considered

Continue using JWK. This encrypted PEM file is primarily for compatibility reasons.

Additional context

@CMCDragonkai CMCDragonkai added the enhancement New feature or request label Aug 14, 2023
@CMCDragonkai
Copy link
Member Author

When starting an agent we can pass in a privateKeyPath. This should automatically support:

  1. JWK file for Ed25519 key
  2. PEM file for Ed25519 key - pkcs#8 PEM
  3. Encrypted PEM file for Ed25519 key - pkcs#8 PEM

The primary usecase is to allow starting an agent with a pre-generated key, which can be useful for specialise bootstrapping procedures.

@CMCDragonkai
Copy link
Member Author

I checked with chatgpt, this requires some dynamic parsing, constrained by the algorithms supported by @peculiar/webcrypto.

See: https://chat.openai.com/share/8fdabc27-4e37-41e7-a639-3b1a5abc548d - make sure to read to the end.

@CMCDragonkai CMCDragonkai added the r&d:polykey:core activity 2 Cross Platform Cryptography for JavaScript Platforms label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request r&d:polykey:core activity 2 Cross Platform Cryptography for JavaScript Platforms
Development

No branches or pull requests

1 participant