Error "Enc.bufToHex is not a function" #1

Open
opened 2021-03-16 17:08:08 +00:00 by Ghost · 1 comment

Created a test ssh key and exported the public key from an FTP client. Getting the error "Enc.bufToHex is not a function" when I try to use the script. Below is the public key:

---- BEGIN SSH2 PUBLIC KEY ----
AAAAB3NzaC1yc2EAAAABJQAAAQEAxT4igjwPdYTVOCpJYNfjcC8H4AK5dKwoJPq
x3HEI2LpBNkBHW0yb64YYoKJe63J13QFP6YEsDrDaRGSf4PGBjzSebiNW9xi4z7
xmiykpARxFtiVZ9IebS/cZ0ZcvctUFxDFmW/1yLisAp/dnpQ3/9YT4o9t7b5YMT
XaIbuJZ1GksRzyJpq17mCHoE6ESa3/D2Icafm7mCZR9OFBYFHH0TJ29/VaRNYME
2u1uLR84InI4rg8gPDWzPO0eShJH71HJmyOtvrFTDf+qBWxIkSKnqlf2A/bcg5S
KGyelI+4cnYeAaulqsPLqeak9fkS8FuuYJ+NrwnvZYEZdKefwJAWtBw==
---- END SSH2 PUBLIC KEY ----
Created a test ssh key and exported the public key from an FTP client. Getting the error "Enc.bufToHex is not a function" when I try to use the script. Below is the public key: ```txt ---- BEGIN SSH2 PUBLIC KEY ---- AAAAB3NzaC1yc2EAAAABJQAAAQEAxT4igjwPdYTVOCpJYNfjcC8H4AK5dKwoJPq x3HEI2LpBNkBHW0yb64YYoKJe63J13QFP6YEsDrDaRGSf4PGBjzSebiNW9xi4z7 xmiykpARxFtiVZ9IebS/cZ0ZcvctUFxDFmW/1yLisAp/dnpQ3/9YT4o9t7b5YMT XaIbuJZ1GksRzyJpq17mCHoE6ESa3/D2Icafm7mCZR9OFBYFHH0TJ29/VaRNYME 2u1uLR84InI4rg8gPDWzPO0eShJH71HJmyOtvrFTDf+qBWxIkSKnqlf2A/bcg5S KGyelI+4cnYeAaulqsPLqeak9fkS8FuuYJ+NrwnvZYEZdKefwJAWtBw== ---- END SSH2 PUBLIC KEY ---- ```
Owner

That's not a standard format for an Public key.

It's also not the bespoke OpenSSH format.

It could be that it's a normal RSA or ECDSA key with a strange header, or it may be entirely bespoke.

Try omitting the SSH2 and try parsing it with Keypairs.js instead.

---- BEGIN PUBLIC KEY ----
AAAAB3NzaC1yc2EAAAABJQAAAQEAxT4igjwPdYTVOCpJYNfjcC8H4AK5dKwoJPq
x3HEI2LpBNkBHW0yb64YYoKJe63J13QFP6YEsDrDaRGSf4PGBjzSebiNW9xi4z7
xmiykpARxFtiVZ9IebS/cZ0ZcvctUFxDFmW/1yLisAp/dnpQ3/9YT4o9t7b5YMT
XaIbuJZ1GksRzyJpq17mCHoE6ESa3/D2Icafm7mCZR9OFBYFHH0TJ29/VaRNYME
2u1uLR84InI4rg8gPDWzPO0eShJH71HJmyOtvrFTDf+qBWxIkSKnqlf2A/bcg5S
KGyelI+4cnYeAaulqsPLqeak9fkS8FuuYJ+NrwnvZYEZdKefwJAWtBw==
---- END PUBLIC KEY ----

Once parsed you will need to look at the code a little bit to figure out how to do the fingerprinting.

See also:

If this is critically important I can definitely figure this out for you as a paid gig if interested: aj@therootcompany.com

That's not a standard format for an Public key. It's also not the bespoke OpenSSH format. It could be that it's a normal RSA or ECDSA key with a strange header, or it may be entirely bespoke. Try omitting the SSH2 and try parsing it with Keypairs.js instead. ```txt ---- BEGIN PUBLIC KEY ---- AAAAB3NzaC1yc2EAAAABJQAAAQEAxT4igjwPdYTVOCpJYNfjcC8H4AK5dKwoJPq x3HEI2LpBNkBHW0yb64YYoKJe63J13QFP6YEsDrDaRGSf4PGBjzSebiNW9xi4z7 xmiykpARxFtiVZ9IebS/cZ0ZcvctUFxDFmW/1yLisAp/dnpQ3/9YT4o9t7b5YMT XaIbuJZ1GksRzyJpq17mCHoE6ESa3/D2Icafm7mCZR9OFBYFHH0TJ29/VaRNYME 2u1uLR84InI4rg8gPDWzPO0eShJH71HJmyOtvrFTDf+qBWxIkSKnqlf2A/bcg5S KGyelI+4cnYeAaulqsPLqeak9fkS8FuuYJ+NrwnvZYEZdKefwJAWtBw== ---- END PUBLIC KEY ---- ``` Once parsed you will need to look at the code a little bit to figure out how to do the fingerprinting. See also: - https://coolaj86.com/articles/openssh-vs-openssl-key-formats/ - https://coolaj86.com/articles/ssh-pubilc-key-fingerprints/ - https://coolaj86.com/articles/the-ssh-public-key-format/ - https://coolaj86.com/articles/the-openssh-private-key-format/ If this is critically important I can definitely figure this out for you as a paid gig if interested: aj@therootcompany.com
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coolaj86/bluecrypt-ssh-fingerprint.js#1
No description provided.