I assume you mean just files on a drive, rather than files in an email...
(which could be s/mime or openpgp or just flat out encrypted). I can't
really think of any better tests--although I think you'd have to be careful
looking for patterns in the text. Could someone with a different character
set throw you off?

Anyway, ascii armored pgp and gnupg files usually have a comment section at
the beginning of the encryption block that reads, for example, "-----BEGIN
PGP MESSAGE-----"  (That's five hyphens I believe.) Following it is a
version line, which may also be useful if you want to capture it. Mine
reads:
Version: Gnupg v1.0.6 (SunOS)

Hope that helps.
-John


                                                                                       
     
                    Ahmed                                                              
     
                    Moustafa             To:     Ray Murphy <[EMAIL PROTECTED]>     
     
                    <ahmed@arborn        cc:     [EMAIL PROTECTED]                    
     
                    et.org>              Subject:     Re: Is A File Encrypted?         
     
                                                                                       
     
                    12/06/01                                                           
     
                    09:13 AM                                                           
     
                                                                                       
     
                                                                                       
     




If you expect a certian pattern of text in the file, I think, you
can grep the file from the expected text pattern. If you find any, then
the file is not encrypted; otherwise, the probability of the file being
encrypted would be higher.

--Ahmed
[EMAIL PROTECTED] | http://arbornet.org/~ahmed

On Thu, 6 Dec 2001, Ray Murphy wrote:

> Hello,
>
> Want to make sure I'm not missing anything here.  My
> task is to see if a file looks like it's encrypted.
> I'm splitting the path/filename/extension via
> File::Basename and checking to see if the extension is
> ..pgp or .gpg.  I'm also checking to see if the file is
> a text file via 'if (-T $file)'.  Is there any other
> (better) way of testing to see if a file is encrypted?
>  I don't want to call the decryption routines if the
> file is not encrypted.
>
> Cheers
>
> Ray.
>
> __________________________________________________
> Do You Yahoo!?
> Send your FREE holiday greetings online!
> http://greetings.yahoo.com
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to