Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Check Node.js version
run: node -pe process.versions
- name: Check npm version
Expand Down
14 changes: 13 additions & 1 deletion lib/keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,19 @@ function parseDERs(keyType, pub, priv) {
// - Attributes (absent)

reader = new Ber.Reader(reader.readString(Ber.OctetString, true));
const privBin = reader.readString(Ber.OctetString, true);
let privBin = reader.readString(Ber.OctetString, true);
if (privBin.length !== 32) {
if (privBin.length === 64
&& privBin.subarray(32).equals(pubBin)) {
privBin = privBin.subarray(0, 32);
} else if (privBin.length > 2
&& privBin[0] === 0x04
&& privBin[1] + 2 === privBin.length) {
privBin = privBin.subarray(2);
}
}
if (privBin.length !== 32)
throw new Error('Malformed ED25519 private key');

/*
OpenSSH ed25519 private key:
Expand Down
5 changes: 5 additions & 0 deletions lib/protocol/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ if (eddsaSupported)
DEFAULT_SERVER_HOST_KEY.unshift('ssh-ed25519');
const SUPPORTED_SERVER_HOST_KEY = DEFAULT_SERVER_HOST_KEY.concat([
'ssh-dss',
// FIDO/U2F security keys (e.g. YubiKey). Not enabled by default for
// host keys (rare in practice) but recognized for client publickey auth.
'sk-ecdsa-sha2-nistp256@openssh.com',
]);
if (eddsaSupported)
SUPPORTED_SERVER_HOST_KEY.push('sk-ssh-ed25519@openssh.com');


const canUseCipher = (() => {
Expand Down
4 changes: 2 additions & 2 deletions lib/protocol/handlers.misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ module.exports = {
if (signature !== undefined) {
if (signature.length > (4 + keyAlgo.length + 4)
&& signature.utf8Slice(4, 4 + keyAlgo.length) === keyAlgo) {
// Skip algoLen + algo + sigLen
// Skip algoLen + algo + sigLen (leave the sigblob intact)
signature = bufferSlice(signature, 4 + keyAlgo.length + 4);
}

Expand Down Expand Up @@ -320,7 +320,7 @@ module.exports = {
if (signature !== undefined) {
if (signature.length > (4 + keyAlgo.length + 4)
&& signature.utf8Slice(4, 4 + keyAlgo.length) === keyAlgo) {
// Skip algoLen + algo + sigLen
// Skip algoLen + algo + sigLen (leave the sigblob intact)
signature = bufferSlice(signature, 4 + keyAlgo.length + 4);
}

Expand Down
Loading