summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inbox_settings.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/inbox_settings.php b/inbox_settings.php
index 4e7b24f..5e96974 100644
--- a/inbox_settings.php
+++ b/inbox_settings.php
@@ -375,20 +375,24 @@ class inbox_settings extends rcube_plugin {
$parsed_keys = [];
$fingerprint = null;
- $data_message = new OpenPGP_Message();
+ $data_message = null;
foreach ($parsed_data->packets as $data_packet) {
if ($data_packet instanceof OpenPGP_SecretKeyPacket)
throw new IllegalArgumentException('Input data contains private keys.');
if ($data_packet instanceof OpenPGP_PublicKeyPacket
&& !($data_packet instanceof OpenPGP_PublicSubkeyPacket)) {
- $parsed_keys[] = [
- 'fingerprint' => $fingerprint, 'data_blob' => $data_message->to_bytes()];
+ if (!is_null($fingerprint) && !empty($data_message->packets))
+ $parsed_keys[] = [
+ 'fingerprint' => $fingerprint,
+ 'data_blob' => $data_message->to_bytes()];
+
$fingerprint = $data_packet->fingerprint;
$data_message = new OpenPGP_Message();
- } else if (!($data_packet instanceof OpenPGP_UserIDPacket)
+ } else if ((!($data_packet instanceof OpenPGP_UserIDPacket)
&& !($data_packet instanceof OpenPGP_SignaturePacket)
- && !($data_packet instanceof OpenPGP_PublicSubkeyPacket)) {
+ && !($data_packet instanceof OpenPGP_PublicSubkeyPacket))
+ || is_null($fingerprint)) {
// ignore unknown packet types for the time being
continue;
}