summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/packet/pkesk.rs5
-rw-r--r--openpgp/src/parse.rs4
2 files changed, 5 insertions, 4 deletions
diff --git a/openpgp/src/packet/pkesk.rs b/openpgp/src/packet/pkesk.rs
index 40e7bc37..50ec187a 100644
--- a/openpgp/src/packet/pkesk.rs
+++ b/openpgp/src/packet/pkesk.rs
@@ -161,7 +161,8 @@ impl PKESK3 {
if key_rgn.len() != sym_algo.key_size()? {
return Err(Error::MalformedPacket(
- format!("session key has the wrong size")).into());
+ format!("session key has the wrong size (got: {}, expected: {})",
+ key_rgn.len(), sym_algo.key_size()?)).into())
}
key.copy_from_slice(&plain[key_rgn]);
@@ -174,7 +175,7 @@ impl PKESK3 {
if their_checksum == our_checksum {
Ok((sym_algo, key))
} else {
- Err(Error::MalformedPacket(format!("key checksum wrong"))
+ Err(Error::MalformedPacket("key checksum wrong".to_string())
.into())
}
}
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs
index 549b94f2..eacded35 100644
--- a/openpgp/src/parse.rs
+++ b/openpgp/src/parse.rs
@@ -5185,11 +5185,11 @@ impl<'a> PacketParser<'a> {
if self.content_was_read {
return Err(Error::InvalidOperation(
- format!("Packet's content has already been read.")).into());
+ "Packet's content has already been read.".to_string()).into());
}
if ! self.encrypted {
return Err(Error::InvalidOperation(
- format!("Packet not encrypted.")).into());
+ "Packet not encrypted.".to_string()).into());
}
if algo.key_size()? != key.len () {