ddn.net.ssh.keys
SSH public key and signature codecs (RFC 4253 section 6.6, RFC 8332).
Parses and encodes the key blob formats used by the initial profile (ssh-ed25519, ssh-rsa), parses signature blobs, separates the RSA key-format name from the SHA-2 signature algorithm names, and bridges parsed keys to the ddn-crypto verifiers. OpenSSH public-key lines and SHA-256 fingerprints round out the trust-facing surface.
The SHA-1 based ssh-rsa signature algorithm is never accepted: parsing succeeds (peers may offer it), but verification rejects it with a typed error, keeping the no-SHA-1-signature policy of the initial profile in one place.
Types 5
Raised for malformed, unsupported, or policy-rejected key or signature material.
this(string msg, string file = __FILE__, size_t line = __LINE__)Constructs a key-codec exception.Key-codec limits from the support matrix.
A parsed SSH public key.
Field data are slices into the parsed blob; keep the blob alive as long as the struct is used. rawBlob preserves the exact received bytes for fingerprinting and transcript hashing.
string keyAlgorithmKey-format name, for example ssh-ed25519 or ssh-rsaconst(ubyte)[] ed25519KeyEd25519 public key bytes (valid for ssh-ed25519)const(ubyte)[] rsaERSA public exponent magnitude (valid for ssh-rsa)const(ubyte)[] rsaNRSA modulus magnitude (valid for ssh-rsa)string ecdsaCurveECDSA curve identifier (valid for ecdsa-sha2-nistp256)const(ubyte)[] ecdsaPointSEC 1 uncompressed point (valid for ecdsa-sha2-nistp256)string commentComment from a public-key line, empty when absentconst(ubyte)[] rawBlobThe complete blob the key was parsed fromA parsed SSH signature blob.
string signatureAlgorithmSignature algorithm name, for example rsa-sha2-256const(ubyte)[] signatureAlgorithm-specific signature bodyVerifies SSH signatures against a parsed public key using the ddn-crypto primitives.
SshPublicKeyVerifier create(SshParsedPublicKey key) static @safeCreates a verifier for a parsed key.bool verify(const(ubyte)[] signedData,
scope const SshParsedSignature signature)Verifies a signature over the given data.this(SshParsedPublicKey key)Functions 13
SshParsedPublicKey parseSshPublicKeyBlob(const(ubyte)[] blob) @safeParses a public key blob (the string payload of a key exchange or the base64 body of a public-key line).bool isParsedSshPublicKeyAlgorithm(string algorithm) @safe pure nothrowWhether a public key blob advertising this algorithm name can be structurally parsed by parseSshPublicKeyBlob.ubyte[] buildSshEd25519PublicKeyBlob(const(ubyte)[] keyBytes) @safeBuilds a wire-encoded ssh-ed25519 public key blob.ubyte[] buildSshRsaPublicKeyBlob(const(ubyte)[] e, const(ubyte)[] n) @safeBuilds a wire-encoded ssh-rsa public key blob from magnitude bytes.ubyte[] buildSshEcdsaP256PublicKeyBlob(
const(ubyte)[] uncompressedPoint) @safeBuilds a wire-encoded ecdsa-sha2-nistp256 public key blob.ubyte[] sshEcdsaP256SignatureBodyFromRaw(
const(ubyte)[] rawSignature) @safeConverts a fixed-width P-256 signature to the SSH ECDSA body.ubyte[] sshEcdsaP256SignatureBodyToRaw(
const(ubyte)[] signatureBody) @safeConverts an SSH ECDSA body to fixed-width primitive form.SshParsedSignature parseSshSignatureBlob(const(ubyte)[] blob) @safeParses a signature blob into its algorithm name and raw signature.ubyte[] buildSshSignatureBlob(string algorithm,
const(ubyte)[] signature) @safeBuilds a wire-encoded signature blob.bool isSupportedSignatureAlgorithm(string algorithm) @safe pure nothrowChecks whether a signature algorithm is accepted by the initial profile policy.string sshKeyFingerprintSha256(const(ubyte)[] blob)Computes the unpadded base64 SHA-256 fingerprint of a key blob.string formatSshFingerprint(const(ubyte)[] blob)Formats a fingerprint the way OpenSSH tools display it.SshParsedPublicKey parseOpenSSHPublicKeyLine(string line,
size_t maxLine = 16384) @safeParses an OpenSSH public-key line: algorithm, base64 blob, optional comment.