ssh_signature (ssh_signature v0.1.0)

Link to this section Summary

Functions

Sign Data using SSH signature format with Key.

Verify Signature of Data.

Link to this section Types

Link to this type

hash_algorithm/0

-type hash_algorithm() :: sha256 | sha512.
-type namespace() :: unicode:chardata().

Link to this section Functions

Link to this function

sign(Data, Key, NS)

Equivalent to sign(Data, Key, NS, #{}).

Link to this function

sign(Data, Key, NS, Opts)

-spec sign(iodata(), public_key:private_key(), namespace(), Opts) -> unicode:chardata()
        when Opts :: #{hash => hash_algorithm()}.

Sign Data using SSH signature format with Key.

The NS must be not empty.

options

Options

  • hash - hash algorithm used on input data. Can be either sha256 or sha512. Defaults to sha512.
Link to this function

verify(Data, Signature)

-spec verify(iodata(), unicode:chardata()) -> {ok, Result} | {error, term()}
          when
              Result ::
                  #{ns => namespace(),
                    public_key => public_key:public_key(),
                    signature => binary()}.

Verify Signature of Data.

Notice that this function do not check authenticity of the provided key. That is left to the user to check whether key used for signing match the requirements.