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

Remove type byte from publicBase64Key in keytool show command #4311

Closed
Thoralf-M opened this issue Nov 29, 2024 · 2 comments · Fixed by #4637
Closed

Remove type byte from publicBase64Key in keytool show command #4311

Thoralf-M opened this issue Nov 29, 2024 · 2 comments · Fixed by #4637
Assignees
Labels
dev-tools Issues related to the Developer Tools Team enhancement New feature or request good first issue Good for newcomers

Comments

@Thoralf-M
Copy link
Member

Thoralf-M commented Nov 29, 2024

Description

Display the publicBase64Key without the type byte in keytool show command. The type byte is printed as flag already, so the information is still available in the output.

Current output for a file with iota keytool show *.key (generated with iota keytool generate ed25519)

╭─────────────────┬──────────────────────────────────────────────────────────────────────╮
│ alias           │                                                                      │
│ iotaAddress     │  0xe31b23056c07513b7030682280a94d16afcdfe5104bddc892fc4c29c3c0e425f  │
│ publicBase64Key │  AN9wG38RCDrGWnOTjl2IZsDpRGrv4/+De1eenIk72KfB                        │
│ keyScheme       │  ed25519                                                             │
│ flag            │  0                                                                   │
│ peerId          │  df701b7f11083ac65a73938e5d8866c0e9446aefe3ff837b579e9c893bd8a7c1    │
╰─────────────────┴──────────────────────────────────────────────────────────────────────╯

publicBase64Key to bytes = 0,223,112,27,127,17,8,58,198,90,115,147,142,93,136,102,192,233,68,106,239,227,255,131,123,87,158,156,137,59,216,167,193 (starts with 0 byte, 33 bytes)
should look like this instead

╭─────────────────┬──────────────────────────────────────────────────────────────────────╮
│ alias           │                                                                      │
│ iotaAddress     │  0xe31b23056c07513b7030682280a94d16afcdfe5104bddc892fc4c29c3c0e425f  │
│ publicBase64Key │  33AbfxEIOsZac5OOXYhmwOlEau/j/4N7V56ciTvYp8E=                        │
│ keyScheme       │  ed25519                                                             │
│ flag            │  0                                                                   │
│ peerId          │  df701b7f11083ac65a73938e5d8866c0e9446aefe3ff837b579e9c893bd8a7c1    │
╰─────────────────┴──────────────────────────────────────────────────────────────────────╯

publicBase64Key to bytes = 223,112,27,127,17,8,58,198,90,115,147,142,93,136,102,192,233,68,106,239,227,255,131,123,87,158,156,137,59,216,167,193 (doesn't start with 0 byte, only 32 bytes)

Motivation

iotax_getLatestIotaSystemState and validator.info contains the base64 encoded public key without the type byte and keytool show currently shows the base64 key with the key type byte, requiring additional conversions to compare them.
For validators it's better if they can just use iota keytool show and compare two the base64 strings directly.

Requirements

Change

public_base64_key: pk.encode_base64(),
to something like Base64::encode(pk.as_ref())

Are you planning to do it yourself in a pull request?

No.

@Thoralf-M Thoralf-M added dev-tools Issues related to the Developer Tools Team enhancement New feature or request good first issue Good for newcomers labels Nov 29, 2024
@thibault-martinez
Copy link
Member

Requirements

Change

iota/crates/iota/src/keytool.rs

Line 481 in d899a6c

public_base64_key: pk.encode_base64(),
to Base64::encode(pk.as_ref())

Just saw that the code you are pointing to is in DecodeMultiSig, is that a mistake?
If it's supposed to be in Show, the change is not that straightforward.

@Thoralf-M
Copy link
Member Author

Requirements

Change
iota/crates/iota/src/keytool.rs
Line 481 in d899a6c
public_base64_key: pk.encode_base64(),
to Base64::encode(pk.as_ref())

Just saw that the code you are pointing to is in DecodeMultiSig, is that a mistake? If it's supposed to be in Show, the change is not that straightforward.

Yes, sorry, changed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-tools Issues related to the Developer Tools Team enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants