-
Notifications
You must be signed in to change notification settings - Fork 167
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
PEM/DER Support for Curve25519 #82
Comments
This is a good idea. I'll circulate the idea around and see how we feel about it. |
I will add:
This is not true: Curve25519 public keys are not being emitted compressed, but they are always 32-bytes (Curve25519 keys only need the x coordinate). So the current output of the library is sufficient to produce a PEM format. |
Yes, I tried. Here's my question and the answer that I got for this. This is working 👍 |
Just wanted to mention regarding:
These values are available out on the internet in RFC8410 listed by the algorithm identifier OID. It looks like Quinn was giving you a head start on defining this structure when the following was provided: let prefix = Data([0x30, 0x2A, 0x30, 0x05, 0x06, 0x03, 0x2B, 0x65, 0x6E, 0x03, 0x21, 0x00]) Which roughly translates to: 0x30 = SEQUENCE (42 bytes length (0x2A)) And that is why appending your raw key bytes to your prefix worked out to generate your PEM. |
Thank you @agnosticdev for that detailed description :) |
Renaming the issue to better reflect what this is about. We'll take it in for consideration! |
New API Proposal: Curve25519
Motivation:
I know CryptoKit provides Curve25519, but to export the public key as a pem string is not possible, as the raw representation of the key is compressed 32 bytes. For pem, we require uncompressed bytes along with ASN1 encoding and other stuff right?
Importance:
Saw in the source code the files like SubjectPublicKeyInfo.swift. This helps wrap the raw bytes and export them as pem. My current requirement is to export the curve25519 public key as a pem string. No libraries out there does this currently.
The text was updated successfully, but these errors were encountered: