feat: update deno-sshsig-mod.ts
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
*.sshsig
|
||||||
.idea/
|
.idea/
|
||||||
# ---> macOS
|
# ---> macOS
|
||||||
# General
|
# General
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { crypto } from "jsr:@std/crypto";
|
import {crypto} from "jsr:@std/crypto";
|
||||||
import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64";
|
import {decodeBase64, encodeBase64} from "jsr:@std/encoding/base64";
|
||||||
import { encodeBase64Url } from "jsr:@std/encoding/base64url";
|
import {encodeBase64Url} from "jsr:@std/encoding/base64url";
|
||||||
import { decodeHex, encodeHex } from "jsr:@std/encoding/hex";
|
import {decodeHex, encodeHex} from "jsr:@std/encoding/hex";
|
||||||
|
|
||||||
// IMPORTANT: ONLY supports ECDSA P256 and P384
|
// IMPORTANT: ONLY supports ECDSA P256 and P384
|
||||||
|
|
||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user