feat: update deno-sshsig-mod.ts

This commit is contained in:
2025-01-19 15:10:32 +08:00
parent c2e741ef16
commit eb6357f6bb
2 changed files with 13 additions and 6 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.sshsig
.idea/ .idea/
# ---> macOS # ---> macOS
# General # General

View File

@@ -285,12 +285,18 @@ export class SshSignatureValue {
// crypto.subtle.sign's signature is R and S // crypto.subtle.sign's signature is R and S
toRs(): Uint8Array { toRs(): Uint8Array {
const writer = new BinaryWriter(); const writer = new BinaryWriter();
if (this.ecSignatureR.byteLength === 0x21) { if (
this.ecSignatureR.byteLength === 0x21 ||
this.ecSignatureR.byteLength === 0x31
) {
writer.writeBytes(this.ecSignatureR.slice(1)); writer.writeBytes(this.ecSignatureR.slice(1));
} else { } else {
writer.writeBytes(this.ecSignatureR); writer.writeBytes(this.ecSignatureR);
} }
if (this.ecSignatureS.byteLength === 0x21) { if (
this.ecSignatureS.byteLength === 0x21 ||
this.ecSignatureS.byteLength === 0x31
) {
writer.writeBytes(this.ecSignatureS.slice(1)); writer.writeBytes(this.ecSignatureS.slice(1));
} else { } else {
writer.writeBytes(this.ecSignatureS); writer.writeBytes(this.ecSignatureS);