|
From: Edwin W. <ed...@wo...> - 2005-01-17 22:35:00
|
--On 17-1-2005 11:11 -0800 Chance Casey <cha...@gm...> wrote: > > Is there a non-CPU-intensive way to check if a message is > PGP-encrypted? We may need to decrypt messages encrypted in other > formats so a quick way to check for PGP would be great. For ascii messages: just check for a line starting with '----- BEGIN PGP'. For binary messages: that's a bit harder. But using Cryptix OpenPGP's MessageFactory it is still easy to do: if it returns an EncryptedMessage, you have a valid PGP message. If it throws an exception, returns a LiteralMessage or returns nothing: you've got something else. The latter approach btw also works for ascii messages. It is not very cpu-intensive compared to the actual decrypting of the message. -- Edwin |