<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version  -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>


<rfc ipr="trust200902" docName="draft-josefsson-sshsig-format-00" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true">
  <front>
    <title abbrev="SSHSIG">Lightweight Secure Shell (SSH) Signature Format</title>

    <author fullname="Damien Miller">
      <organization>OpenSSH</organization>
      <address>
        <email>djm@mindrot.org</email>
      </address>
    </author>
    <author fullname="Simon Josefsson" role="editor">
      <organization></organization>
      <address>
        <email>simon@josefsson.org</email>
      </address>
    </author>

    <date year="2025" month="February" day="08"/>

    <area>IETF</area>
    <workgroup>Secure Shell Maintenance</workgroup>
    <keyword>SSH</keyword> <keyword>Secure Shell</keyword> <keyword>Signature</keyword> <keyword>secsh</keyword>

    <abstract>


<t>This document describes a lightweight SSH Signature format that is
compatible with SSH keys and wire formats.</t>



    </abstract>

    <note title="About This Document" removeInRFC="true">
      <t>
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-josefsson-sshsig-format/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        SSHM Working Group mailing list (<eref target="mailto:ssh@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/ssh/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://gitlab.com/jas/ietf-sshsig-format"/>.</t>
    </note>


  </front>

  <middle>


<section anchor="introduction"><name>Introduction</name>

<t>Secure Shell (SSH) <xref target="RFC4251"></xref> is a secure remote-login protocol. It
provides for an extensible variety of public key algorithms for
identifying servers and users to one another.</t>

<t>The SSH key and signature formats have found uses outside of the
interactive online SSH protocol itself.  This document specify these
formats.</t>

<t>At present, only detached and armored signatures are supported.</t>

</section>
<section anchor="conventions-used-in-this-document"><name>Conventions Used In This Document</name>

<t>The descriptions of key and signature formats use the notation
introduced in <xref target="RFC4251"></xref>.</t>

<t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>

</section>
<section anchor="armored-format"><name>Armored format</name>

<t>The Armored SSH signatures consist of a header, a base64 encoded blob,
and a footer.</t>

<t>The header is the string "-----BEGIN SSH SIGNATURE-----" followed by a
newline. The footer is the string "-----END SSH SIGNATURE-----"
immediately after a newline.</t>

<t>The header <bcp14>MUST</bcp14> be present at the start of every signature.  Files
containing the signature <bcp14>MUST</bcp14> start with the header.  Likewise, the
footer <bcp14>MUST</bcp14> be present at the end of every signature.</t>

<t>The base64 encoded blob <bcp14>SHOULD</bcp14> be broken up by newlines every 76
characters.</t>

<t>Example:</t>

<figure><artwork><![CDATA[
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgJKxoLBJBivUPNTUJUSslQTt2hD
jozKvHarKeN8uYFqgAAAADZm9vAAAAAAAAAFMAAAALc3NoLWVkMjU1MTkAAABAKNC4IEbt
Tq0Fb56xhtuE1/lK9H9RZJfON4o6hE9R4ZGFX98gy0+fFJ/1d2/RxnZky0Y7GojwrZkrHT
FgCqVWAQ==
-----END SSH SIGNATURE-----
]]></artwork></figure>

</section>
<section anchor="blob-format"><name>Blob format</name>

<figure><artwork><![CDATA[
<CODE BEGINS>
#define MAGIC_PREAMBLE "SSHSIG"
#define SIG_VERSION    0x01

byte[6] MAGIC_PREAMBLE
 uint32 SIG_VERSION
 string publickey
 string namespace
 string reserved
 string hash_algorithm
 string signature
<CODE ENDS>
]]></artwork></figure>

<t>The publickey field <bcp14>MUST</bcp14> contain the serialisation of the public key
used to make the signature using the usual SSH encoding rules, i.e
<xref target="RFC4253"></xref>, <xref target="RFC5656"></xref>, <xref target="RFC8709"></xref>, etc.</t>

<t>Verifiers <bcp14>MUST</bcp14> reject signatures with versions greater than those they
support.</t>

<t>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 <bcp14>MUST
NOT</bcp14> be the empty string.</t>

<t>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.</t>

<t>Data to be signed is first hashed with the specified hash_algorithm.
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".</t>

<t>The signature itself is made using the SSH signature algorithm and
encoding rules for the chosen key type. For RSA signatures, the
signature algorithm must be "rsa-sha2-512" or "rsa-sha2-256" (i.e.
not the legacy RSA-SHA1 "ssh-rsa").</t>

<t>This blob is encoded as a string using the <xref target="RFC4253"></xref> encoding rules and
base64 encoded to form the middle part of the armored signature.</t>

</section>
<section anchor="signed-data-of-which-the-signature-goes-into-the-blob-above"><name>Signed Data, of which the signature goes into the blob above</name>

<figure><artwork><![CDATA[
<CODE BEGINS>
#define MAGIC_PREAMBLE "SSHSIG"

byte[6] MAGIC_PREAMBLE
 string namespace
 string reserved
 string hash_algorithm
 string H(message)
<CODE ENDS>
]]></artwork></figure>

<t>The preamble is the six-byte sequence "SSHSIG". It is included to
ensure that manual signatures can never be confused with any message
signed during SSH user or host authentication.</t>

<t>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.</t>

<t>The data is concatenated and passed to the SSH signing function.</t>

</section>
<section anchor="iana-considerations"><name>IANA Considerations</name>

<t>None</t>

</section>
<section anchor="security-considerations"><name>Security Considerations</name>

<t>The security considerations of all referenced specifications are
inherited.</t>

<t>Cryptographic algorithms and parameters are usually broken or weakened
over time.  Implementers and users need to continously re-evaluate
that cryptographic algorithms continue to provide the expected level
of security.</t>

<t>Implementations has to follow best practices to avoid security
concerns, and users needs to continously re-evaulate implementations
for security vulnerabilities.</t>

</section>
<section anchor="acknowledgments"><name>Acknowledgments</name>

<t>The text in this document is from <spanx style="verb">PROTOCOL.sshsig</spanx> from OpenSSH which
appears to have been contributed to by at least Sebastian Kinne,
Damien Miller, Markus Friedl, HARUYAMA Seigo, and Pedro Martelletto.</t>

</section>


  </middle>

  <back>

    <references title='Normative References'>



<reference anchor='RFC4251' target='https://www.rfc-editor.org/info/rfc4251'>
  <front>
    <title>The Secure Shell (SSH) Protocol Architecture</title>
    <author fullname='T. Ylonen' initials='T.' surname='Ylonen'/>
    <author fullname='C. Lonvick' initials='C.' role='editor' surname='Lonvick'/>
    <date month='January' year='2006'/>
    <abstract>
      <t>The Secure Shell (SSH) Protocol is a protocol for secure remote login and other secure network services over an insecure network. This document describes the architecture of the SSH protocol, as well as the notation and terminology used in SSH protocol documents. It also discusses the SSH algorithm naming system that allows local extensions. The SSH protocol consists of three major components: The Transport Layer Protocol provides server authentication, confidentiality, and integrity with perfect forward secrecy. The User Authentication Protocol authenticates the client to the server. The Connection Protocol multiplexes the encrypted tunnel into several logical channels. Details of these protocols are described in separate documents. [STANDARDS-TRACK]</t>
    </abstract>
  </front>
  <seriesInfo name='RFC' value='4251'/>
  <seriesInfo name='DOI' value='10.17487/RFC4251'/>
</reference>

<reference anchor='RFC4253' target='https://www.rfc-editor.org/info/rfc4253'>
  <front>
    <title>The Secure Shell (SSH) Transport Layer Protocol</title>
    <author fullname='T. Ylonen' initials='T.' surname='Ylonen'/>
    <author fullname='C. Lonvick' initials='C.' role='editor' surname='Lonvick'/>
    <date month='January' year='2006'/>
    <abstract>
      <t>The Secure Shell (SSH) is a protocol for secure remote login and other secure network services over an insecure network.</t>
      <t>This document describes the SSH transport layer protocol, which typically runs on top of TCP/IP. The protocol can be used as a basis for a number of secure network services. It provides strong encryption, server authentication, and integrity protection. It may also provide compression.</t>
      <t>Key exchange method, public key algorithm, symmetric encryption algorithm, message authentication algorithm, and hash algorithm are all negotiated.</t>
      <t>This document also describes the Diffie-Hellman key exchange method and the minimal set of algorithms that are needed to implement the SSH transport layer protocol. [STANDARDS-TRACK]</t>
    </abstract>
  </front>
  <seriesInfo name='RFC' value='4253'/>
  <seriesInfo name='DOI' value='10.17487/RFC4253'/>
</reference>

<reference anchor='RFC5656' target='https://www.rfc-editor.org/info/rfc5656'>
  <front>
    <title>Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer</title>
    <author fullname='D. Stebila' initials='D.' surname='Stebila'/>
    <author fullname='J. Green' initials='J.' surname='Green'/>
    <date month='December' year='2009'/>
    <abstract>
      <t>This document describes algorithms based on Elliptic Curve Cryptography (ECC) for use within the Secure Shell (SSH) transport protocol. In particular, it specifies Elliptic Curve Diffie-Hellman (ECDH) key agreement, Elliptic Curve Menezes-Qu-Vanstone (ECMQV) key agreement, and Elliptic Curve Digital Signature Algorithm (ECDSA) for use in the SSH Transport Layer protocol. [STANDARDS-TRACK]</t>
    </abstract>
  </front>
  <seriesInfo name='RFC' value='5656'/>
  <seriesInfo name='DOI' value='10.17487/RFC5656'/>
</reference>

<reference anchor='RFC8709' target='https://www.rfc-editor.org/info/rfc8709'>
  <front>
    <title>Ed25519 and Ed448 Public Key Algorithms for the Secure Shell (SSH) Protocol</title>
    <author fullname='B. Harris' initials='B.' surname='Harris'/>
    <author fullname='L. Velvindron' initials='L.' surname='Velvindron'/>
    <date month='February' year='2020'/>
    <abstract>
      <t>This document describes the use of the Ed25519 and Ed448 digital signature algorithms in the Secure Shell (SSH) protocol. Accordingly, this RFC updates RFC 4253.</t>
    </abstract>
  </front>
  <seriesInfo name='RFC' value='8709'/>
  <seriesInfo name='DOI' value='10.17487/RFC8709'/>
</reference>

<reference anchor='RFC2119' target='https://www.rfc-editor.org/info/rfc2119'>
  <front>
    <title>Key words for use in RFCs to Indicate Requirement Levels</title>
    <author fullname='S. Bradner' initials='S.' surname='Bradner'/>
    <date month='March' year='1997'/>
    <abstract>
      <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
    </abstract>
  </front>
  <seriesInfo name='BCP' value='14'/>
  <seriesInfo name='RFC' value='2119'/>
  <seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>

<reference anchor='RFC8174' target='https://www.rfc-editor.org/info/rfc8174'>
  <front>
    <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
    <author fullname='B. Leiba' initials='B.' surname='Leiba'/>
    <date month='May' year='2017'/>
    <abstract>
      <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
    </abstract>
  </front>
  <seriesInfo name='BCP' value='14'/>
  <seriesInfo name='RFC' value='8174'/>
  <seriesInfo name='DOI' value='10.17487/RFC8174'/>
</reference>




    </references>




  </back>

<!-- ##markdown-source:
H4sIADhup2cAA9VY3VIbORa+11NonZtkFxtMgARqZmoMGHCCTYIh2SSVysjd
si3obnUktY0nlTzLPss+2X5H6m7bBOZi92pdldB9Wufo/HznR2o2m8wpl8gD
3jhXk6mbS/qfD2VUGMmHU5kk/OlwePaMD9UkE46oJ9qkwjWYGI2MnIET34e9
0waLdZSJFLJiI8aueaOtHFurs6a1U6smzbFnbG5tsUg4OdFmccCti5nKzQF3
prBue2trf2ubCSPFAe91r06YLUapslbpzC1yWRLnk4N1FftCZU5mIosku5WL
uTbxAeNNDs38n5W1/r2yhV6sjOyUzWRWSPDwidFFHozqN/Aetm281+ZWZRN+
Sp+JngqVgA7TflfSjVvaTIgsTDQFeepcbg82N2kVkdRMtqplm0TYHBk9t3IT
/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