IF Commons GitHub

signers/sshsig/mod

Written to: 5 requirements: 5 proved, 0 partly, 0 failing, 0 with no test recorded. 0014-grc-sshsig FR-001, 0014-grc-sshsig FR-002, 0014-grc-sshsig FR-003, 0014-grc-sshsig FR-004, 0014-grc-sshsig FR-005

The sshsig signer (commons grc 0014-grc-sshsig): a payload signed with an SSH key, in the envelope of DSSE, so that a person signs with the key they already hold (Ed25519, with its passphrase, which only ssh-keygen ever sees) and anyone verifies with the public key alone. Signing is by the system's ssh-keygen -Y sign; verifying is pure, over the SSHSIG format (PROTOCOL.sshsig of OpenSSH) with Web Crypto, so that a machine with no OpenSSH can verify. What is signed is DSSE's pre-authentication encoding of the payload type and the payload, so a signature is bound to what the payload is for. Only Ed25519 keys are verified; any other key type is refused with that said.

import { sshsigSigner, fingerprintOf } from "./mod.ts";
// const signed = await sshsigSigner.sign("application/vnd.example+json", bytes, [{ keyFile: "~/.ssh/id_ed25519" }]);
// const payload = await sshsigSigner.verify(signed.value, "application/vnd.example+json", [{ publicKey: "ssh-ed25519 AAAA..." }]);

Source: commons/grc/src/signers/sshsig/mod.ts

4 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

NAMESPACEconst
const NAMESPACE: "grc-evidence"

The namespace every signature is made in: a signature made for something else does not verify here.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

SignKeytypeno test imports it
type SignKey = { readonly keyFile: string; readonly agent?: boolean };

A key to sign with: the file of the private key (or of the public key where an agent holds the private one, with agent).

VerifyKeytypeno test imports it
type VerifyKey = { readonly publicKey: string };

A public key to verify with: its line, ssh-ed25519 AAAA....

paefunction
function pae(payloadType: string, payload: Uint8Array<ArrayBufferLike>): Uint8Array<ArrayBufferLike>

DSSE's pre-authentication encoding of a payload type and a payload: what is signed.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

fingerprintOffunction
function fingerprintOf(publicKey: string): Promise<Result<string, string>>

The fingerprint of a public key line, SHA256: and the unpadded base64 of the SHA-256 of its blob, as OpenSSH writes it.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

sshsigSignerconst
const sshsigSigner: Signer

The sshsig signer. Its custody is file: the key is held in a file (or by an agent) the person controls.

Imported by 4 tests of the run (4 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.