Move the parameter extraction to its own function

Move the parameter extraction to its own function and generalize it so
it can be reused.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Fix detection of OpenPGP encrypted data

Fix detection of OpenPGP encrypted data and also check the 'protocol'
parameter.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>