Skip to content

Commit 44deecc

Browse files
authored
ssh-key: suggest using Digest for PublicKey::verify() with large msgs (#381)
Closes #380.
1 parent 957d3b5 commit 44deecc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ssh-key/src/public.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,12 @@ impl PublicKey {
224224
/// # }
225225
/// ```
226226
///
227+
/// The entire message has to be loaded into memory for verification. If loading the
228+
/// entire message into memory is a problem consider computing a [Digest] via a
229+
/// streaming API instead, and then signing/verifying a fixed length digest instead.
230+
///
227231
/// [PROTOCOL.sshsig]: https://cvsweb.openbsd.org/src/usr.bin/ssh/PROTOCOL.sshsig?annotate=HEAD
232+
/// [Digest]: https://docs.rs/digest/latest/digest/trait.Digest.html
228233
#[cfg(feature = "alloc")]
229234
pub fn verify(&self, namespace: &str, msg: &[u8], signature: &SshSig) -> Result<()> {
230235
if self.key_data() != signature.public_key() {

0 commit comments

Comments
 (0)