pub struct SshSig { /* private fields */ }
Expand description

sshsig provides a general-purpose signature format based on SSH keys and wire formats.

These signatures can be produced using ssh-keygen -Y sign. They’re encoded as PEM and begin with the following:

-----BEGIN SSH SIGNATURE-----

See PROTOCOL.sshsig for more information.

Implementations

Supported version.

Create a new signature with the given public key, namespace, hash algorithm, and signature.

Decode signature from PEM which begins with the following:

-----BEGIN SSH SIGNATURE-----

Encode signature as PEM which begins with the following:

-----BEGIN SSH SIGNATURE-----

Sign the given message with the provided signing key.

Get the raw message over which the signature for a given message needs to be computed.

This is a low-level function intended for uses cases which can’t be expressed using SshSig::sign, such as if the SigningKey trait can’t be used for some reason.

Once a Signature has been computed over the returned byte vector, SshSig::new can be used to construct the final signature.

Get the signature algorithm.

Get version number for this signature.

Verifiers MUST reject signatures with versions greater than those they support.

Get public key which corresponds to the signing key that produced this signature.

Get the namespace (i.e. domain identifier) for this signature.

The purpose of the namespace value is to specify a unambiguous interpretation domain for the signature, e.g. file signing. This prevents cross-protocol attacks caused by signatures intended for one intended domain being accepted in another. The namespace value MUST NOT be the empty string.

Get reserved data associated with this signature. Typically empty.

The reserved value is present to encode future information (e.g. tags) into the signature. Implementations should ignore the reserved field if it is not empty.

Get the hash algorithm used to produce this signature.

Data to be signed is first hashed with the specified hash_alg. This is done to limit the amount of data presented to the signature operation, which may be of concern if the signing key is held in limited or slow hardware or on a remote ssh-agent. The supported hash algorithms are “sha256” and “sha512”.

Get the structured signature over the given message.

Get the bytes which comprise the serialized signature.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Type returned in the event of a decoding error.
Attempt to decode a value of this type using the provided Reader.
Type returned in the event of an encoding error.
Get the length of this type encoded in bytes, prior to Base64 encoding.
Encode this value using the provided Writer.
Return the length of this type after encoding when prepended with a uint32 length prefix. Read more
Encode this value, first prepending a uint32 length prefix set to Encode::encoded_len. Read more
The associated error which can be returned from parsing.
Parses a string s to return a value of this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Expected PEM type label for a given document, e.g. "PRIVATE KEY"
Validate that a given label matches the expected label.
Converts the given value to a String. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Decode the provided PEM-encoded string, interpreting the Base64-encoded body of the document using the Decode trait. Read more
Encode this type using the Encode trait, writing the resulting PEM document into the provided out buffer. Read more
Encode this type using the Encode trait, writing the resulting PEM document to a returned String. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.