loadSshPrivateKeyFile

fnSshSigner loadSshPrivateKeyFile(const(ubyte)[] fileBytes)

Loads an unencrypted SSH private key file.

The input may be PEM-armored text or raw DER bytes; the format is detected from the content. Exactly one private key must be present.

Parameters

fileBytesComplete file contents.

Returns

A signer over the loaded key; its

SshPrivateKeySigner.publicKey offer is built from the private material and validated.

Throws

SshKeyEncryptionException for encrypted containers;

SshKeyException for malformed, unsupported, oversized, or inconsistent files.

fnSshSigner loadSshPrivateKeyFile(const(ubyte)[] fileBytes, SshPassphraseProvider provider)

Loads a private key file, decrypting encrypted containers with a passphrase acquired from provider.

The provider is called only when the file is actually encrypted and at most maxPassphraseAttempts times per file; a wrong passphrase (detected through the container's integrity check) is retried by asking again. Key loading is synchronous and off the pump path, so a blocking prompt inside the provider is fine.

Applications loading a file repeatedly are encouraged to cache the passphrase per file for the session lifetime instead of prompting again on every load.

Parameters

fileBytesComplete file contents.
providerPassphrase acquisition callback; may be null, which makes this overload behave exactly like the provider-less one.

Returns

A signer over the loaded key; its

SshPrivateKeySigner.publicKey offer is built from the private material and validated.

Throws

SshKeyPassphraseException when the provider declines or

every attempt is rejected; SshKeyEncryptionException for encrypted containers the loader cannot decrypt even with a passphrase; SshKeyException for malformed, unsupported, oversized, or inconsistent files.

fnSshSigner loadSshPrivateKeyFile(string text)

Ditto

fnSshSigner loadSshPrivateKeyFile(string text, SshPassphraseProvider provider)

Ditto