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

feat(common): KeyConverter class to and from PEM/hex/buffe #255

Merged
merged 1 commit into from Sep 17, 2020

Conversation

suyukuoacn
Copy link
Contributor

This PR resolve issue #247

This PR depend on PR #245 and #246 as it uses functionality and test from other PRs.

Copy link
Member

@petermetz petermetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jonathan-m-hamilton jonathan-m-hamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@petermetz petermetz force-pushed the key_converter branch 2 times, most recently from 54d8a26 to 06af537 Compare August 18, 2020 18:28
Copy link
Contributor

@sfuji822 sfuji822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid some class files are misplaced. I would like to hear assumed usage of those classes.
I also suggested some changes to align standard library like Web Crypto API or nodeJS crypto lib.

Signed-off-by: suyukuoacn <su-yu.kuo@accenture.com>

export enum KeyFormat {
Raw = "raw",
Hex = "hex",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think original code https://github.com/blockstack/key-encoder-js defined this as 'der'. Can you use same value to avoid confusion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently Cactus’s key converter does not support 'DER' format.

Here's list of format and enum for the Cactus and the external key encoder representation.

PEM Format - Cactus' enum 'PEM', - Key-Encoder's enum 'PEM'
DER Format - Cactus not support, - Key-Encoder's enum 'DER'
HEX Format - Cactus' enum 'HEX', - Key-Encoder's enum 'RAW'
Buffer/Unit8Array Format - Cactus' enum 'RAW', - Key-Encoder not support.

Copy link
Contributor

@sfuji822 sfuji822 Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment intended to use a meaningful name for the format.
Actually key-encoder obviously supports DER(Distinguished Encoding Rule), which is the official name for the format.
Please refer related description at https://github.com/blockstack/key-encoder-js#encoding-public-keys
I believe you are aligned to the library used, but I just hope to have consistent names that represent their data format actually used.

Suggested CACTUS DataEncoder Description
PEM PEM PEM PEM format
DER (none) RAW portable binary format
HEX HEX (none) typescript value

Copy link
Contributor

@sfuji822 sfuji822 Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Sorry for my misunderstanding.r
Is there any reason to eliminate the DER format which widely is used at may key management implementations.
I will approve this PR, but I will create new issue to support DER, for the case to support portable keys for va
I will create new issue for support DER format, then approve this PR for moment.

Copy link
Contributor

@sfuji822 sfuji822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check my comment reagarding 'hex' format ?
If using 'hex' is correct way format, then I will revoke my comment.

@sfuji822
Copy link
Contributor

I am afraid some class files are misplaced. I would like to hear assumed usage of those classes.
I also suggested some changes to align standard library like Web Crypto API or nodeJS crypto

I will withdraw my comment.

@sfuji822 sfuji822 closed this Sep 14, 2020
@sfuji822
Copy link
Contributor

I am afraid some class files are misplaced. I would like to hear assumed usage of those classes.
I also suggested some changes to align standard library like Web Crypto API or nodeJS crypto lib.

I will withdraw my comment.

@sfuji822
Copy link
Contributor

Can you check my comment reagarding 'hex' format ?
If using 'hex' is correct way format, then I will revoke my comment.

I will withdraw my comment see my new comment below.

@petermetz
Copy link
Member

@sfuji822 Why did you close the pull request? Misclick?

@takeutak takeutak reopened this Sep 15, 2020
Copy link
Contributor

@sfuji822 sfuji822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create a new item on the issue list, and I will pass this PR.

Copy link

@yochliu8 yochliu8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](#278)

@petermetz petermetz deleted the key_converter branch October 6, 2020 18:04
@petermetz
Copy link
Member

@yochliu8 Sorry I don't get it. Could you please clarify?

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.

None yet

6 participants