This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is file encrypted

 
Manju Krishna
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Is there any way to find if the particular file instance is encrypted or not.
One solution what I had was to decrypt and check if the exception is thrown else continue. But it would be an overhead for users not using encryption.

Please help on alternatives . Thanks !
 
akash shrimali
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is no alternative to this one according to me, the only option which you have tried is totally correct !!
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you "decrypt"? There is an endless variety of ciphers, you can't possibly try them all, particularly not if you don't have the keys. And even if you tried just one, and got no exception, how would you decide that the result is not encrypted further? It might be a binary file in cleartext in a format you don't know, or it might be an encrypted file. So, there is no way to know for sure unless you have more information about the file that you didn't mention.
 
Manju Krishna
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have generated a jks file and using that for encrypt and decrypt.!
Moreover I am also using a third party helper called bouncycastle

So when i have encrypted with those keytool and password I try to decrypt using the same !
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so you know the algorithm and you know the key. That makes it quite a bit easier.

But there's no way to tell in general whether a random binary file is encrypted or not.
 
Manju Krishna
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your replies!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic