Wrox Programmer Forums
|
BOOK: Beginning Cryptography with Java
This is the forum to discuss the Wrox book Beginning Cryptography with Java by David Hook; ISBN: 9780764596339
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Cryptography with Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2007, 09:45 PM
Registered User
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Identifying a PGP file

Is there a way to identify a PGP encrypted file based on the file content (like the way a ZIP file can be identified by looking for letters "PK" at the beginning of the file)? We receive multiple files from a client and don't have an idea which ones are PGP encrypted. I need to write code to identify the PGP files and decrypt them automatically. Thanks!!
 
Old July 11th, 2007, 04:37 AM
dgh dgh is offline
Wrox Author
 
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts
Default

The best I could suggest is to look for a PGP packet header in the file - there isn't a magic number associated with PGP files. You'd need to do some analysis on the files you have and look for packet types, internally consistent length headers and the like.

Regards,

David

 
Old July 12th, 2007, 10:47 AM
Registered User
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks David!!

One more question. I wrote a progam to encrypt a file using a public key. I don't have the private key with me to decrypt the file. How do I know if the encryption was successful?

The file was encrypted using a PGP tool previously and I have a copy of the previously encrypted file. Is there a way to compare (byte comparison or something) this previously encrpted file with the one that I encrypted via programming to make they are the same?

Thanks!!

 
Old July 12th, 2007, 07:31 PM
dgh dgh is offline
Wrox Author
 
Join Date: Aug 2005
Posts: 206
Thanks: 0
Thanked 20 Times in 20 Posts
Default

The session key used to encrypt the file is random, so it would be highly unusual for two encryptions of the same file to produce the same encrypted data.

The best way to confirm your program is working is to generate your own public/private key pair, do an encryption, and use another tool like GPG to decrypt the file.

Regards,

David

 
Old July 13th, 2007, 04:05 PM
Registered User
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks David!!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Decrypting pgp files with vbscript tonyromero99 VBScript 4 June 4th, 2008 04:09 AM
PGP Encryption everest C# 2005 4 October 28th, 2007 08:20 PM
IDENTIFYING THE PORTS abdul_owiusa C# 3 August 7th, 2004 04:11 AM
pgp file? ktchlin C# 1 July 26th, 2004 07:49 AM
PGP (GPG) / PHP Help! URGENT!!!!!!!! cmiller PHP How-To 1 July 13th, 2004 06:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.